n8n OAuth and Webhooks on Localhost
Default n8n port
n8n typically runs on port 5678:
# Terminal 1
n8n start
# Terminal 2
npx localtolink --port 5678
Webhook URLs
n8n generates webhook URLs based on its configured base URL. For local testing with a tunnel, use the public URL in your workflow's Webhook node:
https://YOUR-SUBDOMAIN.localtolink.com/webhook/your-path
Or configure n8n's WEBHOOK_URL environment variable:
WEBHOOK_URL=https://YOUR-SUBDOMAIN.localtolink.com/ n8n start
Update this when the subdomain changes.
OAuth credentials in n8n
For nodes requiring OAuth (Google Sheets, Slack, etc.):
- Register redirect URI in the provider:
https://YOUR-SUBDOMAIN.localtolink.com/rest/oauth2-credential/callback - Create credentials in n8n using the same OAuth app
- Complete the OAuth flow in a browser (click through the interstitial once)
See OAuth Callback on Localhost for general OAuth guidance.
Notes
- n8n webhook POSTs bypass the browser interstitial
- WebSocket may be used by n8n's UI — works through the tunnel for browser access
- Session limit: 2 hours, 1 GB
- No custom subdomain in v1.0 — update
WEBHOOK_URLon each new session
Try it now
Start a tunnel from your project directory — no account required.
$ npx localtolink