How do I setup basic login for n8n installed with npm?

Key concepts | Docs - I want to add a basic authentication for my n8n instance. But I installed n8n using npm, not docker. I cannot use it with docker for server-related issues. It would be great if I had some way to implement the basic login security feature on my instance.

How are you running n8n? You just need to set the environment variables, and how to do that will depend on how you are running n8n.

If you are just running it from the command line, set the environment variables before starting n8n.

export N8N_BASIC_AUTH_ACTIVE=true
export N8N_BASIC_AUTH_USER=<USER>
export N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
n8n

You can also configure the basic auth using the configuration file: Configuration | Docs

1 Like

New documentation for setup ligin Security - n8n Documentation

1 Like