Skip to main content

Credentials & Authentication

Credentials in n8n handle authentication for external services. They’re defined separately from nodes and can be shared across multiple node types.

ICredentialType Interface

All credentials implement the ICredentialType interface:

Required Properties

Basic Authentication Examples

Simple API key authentication:

OAuth2 Credentials

OAuth2 credentials require additional configuration:

Credential Testing

The test property defines how to validate credentials:

Using Credentials in Nodes

Declaring Credentials

In your node’s description:

Accessing Credentials

Conditional Credential Fields

Show/hide credential fields based on other fields:

Real-World Example: AMQP Credentials

Here’s the complete AMQP credential test from the source:

Security Best Practices

Follow these security guidelines when implementing credentials.
1

Use Password Type

Always use typeOptions: { password: true } for sensitive fields:
2

Validate Credentials

Always implement a test request or custom test function to validate credentials.
3

Handle Errors Securely

Don’t expose sensitive information in error messages:
4

Use HTTPS

Always use HTTPS for API endpoints in credential tests and authentication.

Common Patterns

Multi-Region Support

Custom Domain Support

Next Steps

Testing

Learn how to test nodes and credentials

Node Structure

Understand how to use credentials in nodes