Authentication
Sign in to n8n MCP Bridge using OAuth, Magic Link, or OTP codes
Authentication
n8n MCP Bridge offers three authentication methods to suit your security and convenience preferences:
- OAuth (Google, GitHub) - Quick social login
- Magic Link - Passwordless email authentication
- OTP Codes - Secure 6-digit verification codes
Sign In Methods
Method 1: OAuth (Social Login)
Sign in with your existing Google or GitHub account.
Using Google:
- Navigate to http://localhost:3000/auth/signin
- Click Continue with Google
- Select your Google account
- Authorize the application
- You'll be redirected to the dashboard
Using GitHub:
- Navigate to http://localhost:3000/auth/signin
- Click Continue with GitHub
- Authorize the application
- You'll be redirected to the dashboard
Method 2: Magic Link
Receive a sign-in link via email (no password needed).
- Navigate to http://localhost:3000/auth/signin
- Ensure Magic Link is selected (default)
- Enter your email address
- Click Send Magic Link
- Check your email for the sign-in link
- Click the link to sign in
- You'll be automatically redirected to the dashboard
Link expires in 15 minutes for security.
Method 3: OTP (Verification Code)
Receive a 6-digit code via email for enhanced security.
- Navigate to http://localhost:3000/auth/signin
- Click Verification Code toggle
- Enter your email address
- Click Send Code
- Check your email for the 6-digit code
- Enter the code on the sign-in page
- Click Sign In
- You'll be redirected to the dashboard
Code expires in 10 minutes for security.
Note: If you don't receive the code, check your spam folder or click "Send a new code" after waiting a minute.
First-Time Setup
After signing in for the first time:
- Your user account is automatically created
- You're assigned the
USERrole by default - You're redirected to the dashboard at
/dashboard
Session Management
Session Duration
- Sessions are valid for 30 days by default
- Sessions are stored securely using JWT tokens
- Encrypted session data is stored in the database
Sign Out
To sign out:
- Click your profile icon in the top-right corner
- Select Sign Out
- You'll be redirected to the homepage
Your session will be invalidated and removed from the database.
Account Management
Linked Accounts
You can link multiple OAuth providers to the same account:
- Sign in with your primary provider (e.g., Google)
- Go to account settings
- Link additional providers (e.g., GitHub)
This allows you to sign in using any linked provider.
Account Information
View your account details in the dashboard:
- Email: Your primary email from OAuth provider
- Name: Your display name
- Provider: Which OAuth provider(s) you've used
- Role: Your user role (USER or ADMIN)
Email Configuration (for Magic Link & OTP)
To use Magic Link or OTP authentication, configure SMTP in your .env file:
SMTP_HOST="smtp.gmail.com" # Your SMTP server
SMTP_PORT="587" # 587 for TLS, 465 for SSL
SMTP_SECURE="false" # true for SSL, false for TLS
SMTP_USER="your-email@gmail.com" # Your email address
SMTP_PASSWORD="your-app-password" # App-specific password
SMTP_FROM="noreply@example.com" # From address
SMTP_FROM_NAME="n8n MCP Bridge" # From name
Warning: For Gmail, you must use an App Password, not your regular password. 2FA must be enabled to create app passwords.
After updating .env, restart the application:
task dev
Security
Authentication Methods Security
OAuth (Google, GitHub)
- Uses industry-standard OAuth 2.0 Authorization Code Flow with PKCE
- No passwords stored or managed by the application
- Delegated authentication to trusted providers
Magic Link
- One-time use links with 15-minute expiry
- Links are invalidated after first use
- Secure token validation via database
OTP Codes
- 6-digit numeric codes (1 million combinations)
- 10-minute expiry window
- One-time use only
- Rate limited to 10 attempts per minute
Data Privacy
- No passwords stored: All authentication is passwordless
- Minimal data collection: Only email and name are stored
- Encrypted sessions: Session tokens are encrypted with AES-256
- Secure cookies: HTTP-only, secure cookies for session management
- Rate limiting: Prevents brute-force attacks (10 requests/minute)
Role-Based Access
USER Role
Default role for all new users. Can:
- Create and manage their own n8n connections
- Create and manage MCP API keys
- Create and manage OAuth clients
- Use the memory system
- View usage analytics
ADMIN Role
Administrative role with additional permissions:
- Access to admin dashboard
- View all users and their connections
- Manage system settings
- View system-wide analytics
To grant admin access, update the user's role in the database:
UPDATE "user"
SET role = 'ADMIN'
WHERE email = 'user@example.com';
Troubleshooting
Email Not Received (Magic Link / OTP)
If you don't receive the email:
- Check spam/junk folder - Email providers may flag authentication emails
- Verify SMTP configuration - Ensure all
SMTP_*variables are set in.env - Check Docker logs - Look for email sending errors:
docker compose logs app | grep -i smtp - Restart application - SMTP settings require restart:
task dev - Test SMTP credentials - Verify login works at your email provider
- Wait for rate limit - If you tried many times, wait 1-2 minutes
OAuth Error: Redirect URI Mismatch
If you see this error:
- Verify redirect URI in OAuth provider settings
- For Google: Should be
http://localhost:3000/api/auth/callback/google - For GitHub: Should be
http://localhost:3000/api/auth/callback/github - Ensure exact match including protocol and port
OAuth Error: Invalid Client
If authentication fails with "invalid client":
- Check
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETin.env - Verify credentials are correct in OAuth provider console
- Restart the application:
task dev
OTP Code Not Working
If your verification code is rejected:
- Check expiry - Codes expire after 10 minutes
- Verify code - Ensure all 6 digits are entered correctly
- Rate limit - After 10 failed attempts, wait 1 minute
- Request new code - Click "Send a new code" button
- Check email - Use the most recent code received
Session Expired
If your session expires:
- Sign in again using any authentication method
- Your data and settings are preserved
- Sessions last 7 days by default
Next Steps
Now that you're authenticated, create your first API key: