Allow expression for credential selection

The idea is:

At the moment we can use expressions within the setup of credentials. But I would like to use an expression to set the ID of the credentials, this would allow flexibility without having the credentials visible within the workflow and executions.

so instead of

to something like this:

My use case:

Currently I am creating workflows to scrape Workflow and Execution data from multiple environments. Having URL and API key visible in the executions / workflow data isn’t really secure.
If this feature isn’t added I am forced to duplicate my workflows for each n8n environment.
I really hate duplication :sweat_smile:

I think it would be beneficial to add this because:

More secure, more flexibility, and best of all less duplication. :slight_smile:

Any resources to support this?


Are you willing to work on this?

Willing to do the PR myself If I knew where to find the code that makes the selection possible. so far I have only found the credential type that is being set for the execution of the node, but not its ID.
Guessing I am looking in the wrong place.
Searching credentials is of course not really helpful as there is a lot of code referring to it. :slight_smile:

Completely agree, this would help make reusable generic subflows.

I think this might be covered with the new upcoming Environments feature.

1 Like

I don’t expect this be to in the environments feature. But we can hope of course. :slight_smile: