supabase: Logging in with Facebook gives 502 error
Bug report
Facebook login gives 502 error when being set up according to the documentation.
Describe the bug
Following the instructions on: https://supabase.com/docs/guides/auth/auth-facebook
When running the following code:
const { user, session, error } = await supabase.auth.signIn({
provider: 'facebook'
})
I get sent to https://[my-project].supabase.co/auth/v1/authorize?provider=facebook
that gives me 502, bad gateway from Cloudflare.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Create a new Facebook app
- Enter your Facebook apps ID and Secret to Supabase.
- Add you supabase, url +
/auth/v1/callback/
as Valid OAuth Redirect URIs in your Facebook app. - Run the following code
const { user, session, error } = await supabase.auth.signIn({
provider: 'facebook'
})
Expected behavior
I would have to accept connecting with Facebook.
Screenshots

System information
- OS: MacOS
- Browser: All
- Version of supabase-js: 1.29.1
- Version of Node.js: 16.13.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 37 (12 by maintainers)
@dthyresson Maybe this issue should be re-opened - multiple people are still reporting it and the team might not have visibility that it still exists.
The problem seems fixed! (on my side) 🎉
hi @bokub, we’re still investigating your project, so far, it seems like this is an issue with gotrue not being able to connect to the db and not an oauth issue, will update you via email when this is resolved!
This issue also comes up for self-hosted issues. Does anyone know how to deal with this? Basically, what occurs is that when SMTP is set, the verification becomes 502.
Still having this error with Google login
I had a user-related
View
in the Table Editor that I had created as a test, and when I deleted it, the login worked fine.Hey all,
We will be closing this issue since it represents a class of issues rather than a single specific issue and we would be able to best track and handle issues via our support channel. As such, reach out to support@supabase.com if you are still facing OAuth related issues.
For even faster resolution, do check out our [Logs explorer] (https://supabase.com/docs/guides/platform/logs) and view the Auth logs. Sometimes the issue could be a simple one(like a permissions error) which can be resolved within seconds!
If there are any further concerns or questions feel free to leave a comment below and we’ll try to get back as soon as we can.
We are seeing the same thing happen with Azure on our end.
So, the problem was fixed last week, but it appeared again…
I now have the following 502 error (exactly like last time):
In my case, it seems like the culprit is custom SMTP - as soon as I enable it, I start getting the error and then even if I disable custom SMTP, I continue getting the error.
@kiwicopple Should I open a separate issue for this?
I am currently experiencing a similar issue when trying to sign-up new users using
supabase.auth.signup()
with E-mail auth. The response I get is 502:Update: the URL now shows this raw JSON instead of the 502 Cloudflare error page:
The response code is still 502 though.
I have the same problem with the E-mail, GitHub and Google providers, so I’m not sure it’s linked to Facebook.
I have 2 projects on Supabase, but only one of them has this issue (it used to work before).
I have restarted the server multiple times and it didn’t fix the issue.
This is a screenshot of
https://[project-id].supabase.co/auth/v1/authorize?provider=github&redirect_to=http%3A%2F%2Flocalhost%3A3000%2Flogin
And I also receive a 502 when calling
POST https://[project-id].supabase.co/auth/v1/magiclink?redirect_to=http%3A%2F%2Flocalhost%3A3000%2Flogin