Change credentials per user in one workflow

Describe the issue/error/question

I want to use one workflow for every user to send email and change credentials by the user.

Is it possible to pass credentials into workflow?

Thank you!

Information on your n8n setup

  • **n8n version:**Version 0.209.4

You can also use expressions in credentials. So you could set them dynamically by passing in the full credential information into the workflow and then access and use that data via an expression like this:

{{ $json.username }}

Goes without saying that it is obviously not the most secure thing to do.

Hey @jan ,

Credential part doesn’t show “fixed/expression” option like the others does.

image

image

I now use the version of 0.213.0

@onurbolaca you just create one credential eg. “placeholder” and within the credential you can use dynamic values like jan suggested.

2 Likes

I see,

Thank you @JUVOJustin !

Since it is not the most secure way, can you recommend a way to send credentials in a more secure way @jan ?

Sadly not a pretty one, but the more secure alternative would be to:

  1. Create for each user new credentials (could be done via the API)
  2. Supply only the ID of the credentials you want to use to the workflow
  3. Use the Execute Workflow Node set to “Parameter”
  4. Change the “Workflow JSON” field to “Expression”
  5. In it, you use the JSON of a simple workflow that uses the node you want to use, and set the ID of the credential dynamically

The best solution (allowing setting whole credentials dynamically via an expression) is currently sadly not supported. For that reason, the ugly workaround above.

4 Likes

Hey @jan ,

Thank you so much.

A question came to my mind after this,

Let’s say a thousand user reached to this workflow at the same time with their credentials, can they use the same workflow with their own credentials at the same time?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.