How to Use Credentials as Variables in n8n’s Code Node: A Simple Workaround

In n8n, while it’s not possible to directly use credentials as variables in the Code node, there’s a simple workaround.

You can store encrypted credentials in a SQL database, retrieve them using the SQL node, and then decrypt them in the Code node. This method ensures your credentials remain secure while still being usable in your workflow.

1 Like

Don’t forget to not save the executions when doing this. As this would be showing the credentials in plain text :wink:

1 Like

Thank you for pointing that out!