Using Credentials as Variables

Describe the problem/error/question

I want to run cmd command using Parameters these parameters are credentials stored in n8n store. Is there a way I can retrieve them and use them in a flow for example.

The username and Password is already stored in n8n but I don’t know how to read them.

Information on your n8n setup

  • **n8n version:1.1
  • Database (default: SQLite):
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • **Operating system: Ubuntu 22
1 Like

Hey @MXA_Music,

At the moment you can’t use credentials as variables but that does sound like an interesting feature request for the future.

At the moment the best I can think of would be to pass the id of the credential to your python script then use the n8n cli to export the decrypted credential and parse that in your python script and use it.

1 Like

Hi @Jon is there another way to store them I was using Config.ini files which will be read or written by workflow but it is exposing API keys and Credentials. so I can utilize n8n encrypted store

Hi Jon,
Just wanted to +1 to this idea as a feature. I would love to be able to use a credential variable in a javascript code node to login to a website for custom automations

Hey @MXA_Music,

Best I can think of if you wanted to store them in n8n would be to do the cli export and keep it all in memory but another option could be to use an external secrets provider in your script.

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