Tunnel for oauth2?

Hi there,

I thought I would be able to simply use the tunnel function for oauth2.0 connections. But I am doing something wrong I guess.
I got the URL after starting n8n with tunnel. But I cannot connect to it and my Oauth2.0 connection pop-up gives a time-out.
Trying to get this to work in n8n with simple http node before starting the development of my node-athon node. Sadly I need to use Oauth2.0 so I am stuck for the moment.
(everything is working on server, but this is not a workable solution if I want to be developing) :slight_smile:

some more info:
Local install
all default (sqllite and all)
with tunnel option (n8n start --tunnel)
Trying to get oauth2.0 working without messing around with my router settings and such.


Hey Bram,
if you are using OAuth2 you can usually use your localhost address as redirect url. Does your service provider allow setting a localhost address?

Hi Marcus,

I thought this was the case idd. Sadly couldn’t get it to work because the service requires an https url. Thats why I tried the tunnel.
Guess I need to try and enable https instead :sweat_smile:

Ok, I am stuck.
What is the fastest way of getting this to work(on windows)?

I think ngrok could be an option if localhost isn’t an option. @Jon suggested this a while back for the desktop app, but it should work for all deployment forms (haven’t tried it myself yet though):

1 Like

To be honest, I don’t even know where to put the .env file. Where ever I put it, it does not get used when starting n8n.

Ah, good point. I don’t actually know which working directory would be used by default on Windows. I think you could just set the variable globally via the system properties on Windows:


You probably need to re-open your terminal after doing so.

I do know @marcus develops on Windows so he probably has a smoother approach :smiley:

hehe thanks. Then I will wait for Marcus to share his expertise.
Not really into changing global properties like this. :sweat_smile:

1 Like

I usually use the npm tool cross-env to set env vars before the start command.

cross-env WEBHOOK_TUNNEL_URL=https://some-long-id.ngrok.io n8n start

To use dotenv via cli you could use dotenv-cli and run dotenv n8n start to pickup the .env file in you cwd.


IT works. :partying_face:
Steps taken:

  • install dotenv-cli
  • create .env file with the webhook_tunnel_url
  • register and setup ngrok
  • start ngrok
  • start n8n with the dotenv-cli
  • use the ngrok url for the oath2 connection.