Can I store credentials for an unsupported platform in the credentials section?
I’m authenticating to the Mosyle MDM platform. See my http node below. There’s an API key involved, and an authentication token with a 24 hr lifespan. I’ve just completed the workflow to check if the authentication token is expired, and if so, regenerate it. This should allow me to only run the api call when needed.
But I don’t want to store the basic auth in the node, and I don’t know which, if any, credential types might work.
No error message.
This is a working setup, it’s just not as secure as it might be if what I’m thinking is possible.
Good news is you can programmatically create credentials with the n8n node like this.
Bad news is there doesn’t seem to be any way to actually select a credential with an expression, defeating the purpose of automating the creation. They say it’s planned but no timeline. There also seems to be no way to actually receive the auth info from the credential section through n8n or any apis.
So it seems like your best way to do that is to store the key/auth info to disk and then add it into the headers manually when needed instead of using the built in auth drop downs, which i see is your current method.
You could encrypt with the crypto node as well.
ps:
For anyone trying to make sense of the create credential node
For the n8n create credential node, finding the right Credential Type is pretty annoying. There is no obvious list of Credential Type’s in the docs. But I found the list on Github here. Find the relevant file and then find the name field right at the start of the class, like name = 'httpHeaderAuth'; and httpHeaderAuth will be the credential type name.
To find the format of the JSON for the data section use this workflow, change the edit field value to your credential type and add in an n8n credential to the webhook.
The JSON output of the http node will be the schema for the structure required in the data field.