HTTP + 0Auth

Hello.
I’m on the n8n cloud version.

I want to create a test page on my website with a button. Upon clicking, users should log in to their Gmail accounts and receive a list of email subjects. In other words, there should be no predefined settings for OAuth. Question: should the workflow be like:

webhook → http request → OAuth → Gmail
or
webhook → OAuth → Gmail

Thank you.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

n8n’s OAuth2 flow isn’t designed for this.

The way OAuth works is you have an app registered with google that you use to connect. That is your client ID and secret. That would stay the same for all users

then it uses a link to sign in with to connect your account.
When someone connects their account, it redirects back to the page. That is crucial. The app (n8n in this case) needs information from that redirect. It gives an access token and a refresh token. Simply put, the page needs to redirect back to your logged in n8n.

Maybe there is a way around this with n8n, I’m not sure it would probably be possible with self hosted but it would be some work.

There isn’t much possibility to jerry rig a solution like redirecting or anything because google will catch it and block it (because that is a common hacking method)


If you want to make this work you would probably have to set up your own auth service. But again, you can’t dynamically use different credentials so you would need to do all custom requests anyway, which would mean you would need to handle OAuth yourself and refresh the tokens which is possible but likely not practically possible considering the question.

Wish i could help more. Sorry for the very long winded way of saying not possible, figured i would just add some context

Thank you for the response!

It’s unclear why it’s not possible, as many other services operate this way. Yes, they may not use n8n, but I don’t think that’s relevant. For example, clickup.com allows you to choose a ready-made workflow and connect the specified services under your credentials.

If not with OAuth, does it mean we need to use the code node?

OAuth2 isn’t as simple as just assigning an API key

It can be implemented differently in different apps. I don’t think there is much more to the story than that unless you get into the nuts and bolts of how it works

When registering an Oauth2 credential in n8n is seems to only accept the redirect link when you press the connect account button.

I just made and send a custom auth link to test it in a cloud account and it didn’t work, which would be the approach you would need to take if you were to try to work around this

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.