Sparround

Credentials and authentication

A credential is the stored form of whatever a service needs to authenticate you: an API key, a username and password, an OAuth token or a long private key.

The core principle: credentials live outside nodes. You create one once, and any number of nodes and workflows refer to it. When the key changes, you update it in one place.

n8n writes credentials to the database encrypted. A random key is generated for that encryption the first time the instance starts and kept in its configuration file. As an extra layer, only node types with the right access can read credential data.

Authentication typeHow it worksWhere you meet it
API KeyA static key sent as a header or query parameterSimple services, internal APIs
Bearer tokenAn `Authorization: Bearer <token>` headerMost modern REST APIs
Basic authUsername and password encoded with base64Legacy systems, internal services
OAuth2You grant access on the service's own page; n8n receives a token and refreshes it itselfGoogle, Slack, Microsoft, GitHub
Header authA header name and value of your choice — for non-standard APIsCustom or internal integrations

The encryption key matters more than the credentials. If you migrate or restore a self-hosted n8n and take only the database, the credentials will not decrypt — without the key they are unreadable. A backup plan must cover the database and the key together.

Practical rules:

  • Give credentials clear names: Google Sheets — Marketing (prod), not Google Sheets account 3
  • Grant the minimum permission wherever possible: do not ask for write access when you only read
  • Keep separate credentials for testing and production where you can
  • Never type a key into a node parameter as plain text — that value ends up inside the file when the workflow is exported

📚 Sources and documentation