I’ve got N8N running on my local machine and I’m stuck with OAuth authentication. The problem is that when I try to connect to APIs that need OAuth callbacks, they can’t reach my localhost URL. I need the external services to be able to call back to my local server but obviously localhost isn’t accessible from the internet. I looked into some tunneling solutions but couldn’t get them working properly. What’s the best way to handle OAuth flows when developing with N8N locally? Are there any reliable methods to expose my local instance safely?
ngrok is ur best bet! just start ngrok http 5678 (if n8n’s on default port) & grab the https link it gives. i’ve been using this for ages, works great for oauth testing on local setups!
I ran into this exact issue last year. While ngrok works well, I actually prefer using Cloudflare Tunnel (formerly Argo Tunnel) for OAuth development. You install cloudflared, run cloudflared tunnel --url localhost:5678 and get a public URL that stays active as long as the tunnel runs. The main advantage is better stability compared to ngrok’s free tier, and you don’t get random URL changes that break your OAuth app configurations. Just remember to update your OAuth callback URLs in your API provider’s dashboard to point to the tunnel URL instead of localhost. I’ve successfully used this approach with Google, GitHub, and Slack APIs without any connectivity issues.
LocalTunnel is another solid option that doesn’t require account setup. Just run npm install -g localtunnel then lt --port 5678 and you get a public URL instantly. I switched to this after having issues with ngrok’s session timeouts during longer development sessions. The URLs are somewhat predictable too, so you can often request the same subdomain if it’s available. One thing to watch out for though - some OAuth providers are picky about SSL certificates, so make sure you’re using the https version of whatever tunnel URL you get. I learned this the hard way when Spotify’s API kept rejecting my callbacks until I switched from http to https in the redirect URI configuration.