Adding Credentials through Workflow

Hi there,

Just wanted to ask is there any way we can add credentials using a workflow having a webhook to receive the credentials?

Thanks

No something like that is sadly currently not possible.

Hi @jan

I was thinking of importing them via the Execute Command Node.
Can we do something with the following command ?

echo "Creds Data Here" >> /home/node/.n8n/database.sqlite

Thanks

I guess something like that would destroy the file and the whole database would not work afterward anymore. So strongly advise against it.

The only thing you could do is to use the REST-API the Editor-UI uses. You can find it here:
https://github.com/n8n-io/n8n/blob/master/packages/cli/src/Server.ts#L747 (line 747)
If you send a POST request in the correct format there, it will create the credentials. You have to be however aware that it can theoretically change at any point as it is not an official API.

2 Likes

Thanks @jan for this. Will try this asap

I already asked something like that here: Outsource Credentials

Sadly for us (because I would really love to use n8n in production) there is no official way to store credentials outside of the n8n application itself or pull them via a special node.

That’s, alone from a security-standpoint, not feasible in production. Credentials should be stored in a central storage and not be distributed wildly in different applications. I think every reasonably big company will agree.

Another obvious problem would be the missing User/Role-Management (only basic auth is a little bit too little) but we could live with that temporarily.

Yes agree @EnCz. That it is currently for sure not perfect for large organizations. I hope we will find time soon to find a good solution for that.