Search code examples
next.jsoauth-2.0vercelsupabase

Google OAuth works on localhost but not on production server


I have set up Google OAuth using Superbase, and it's working fine on my localhost:3000, but not on my production site which is hosted on Vercel.

The problem is like this on my production server.

  • I log in using my Gmail account
  • Get redirected to my site with a ?code attached to the URL.
  • A new cookie is saved to my website.
  • There is no Auth session.

You can see my URL Configuration here. enter image description here

Did I do something wrong? or do I need to change things somewhere else in Google Cloud for example?

One thing to note is that I'm using NextJS 13.


Solution

  • I solved it, it was a typo in the environment variable I used on Vercel. I know, embarrassing.