OAuth 2.0 unable to login

In my NextJs webapp where I have use OAuth 2.0 to login with google account but when ever I try to login in, it show “Try signing in with a different account”.
Please look into my problem and reply asap.

have you tested this locally? does that work there?

if so then try to debug this from “authOptions” file see if it gets run or not

or you can try “hard refresh or a different browser” to see if that behavior changes or not

happy coding :slight_smile:

I have tested locally and it works fine but after deployment I have faced the problem which I have shared.

whats your redirect looks like for “google” developer console? after you “deployed” your app to vercel?

@bappyasif
No, actually it is redirected to
( Sign In )
to this link where it says “Try signing in with a different account”


.
You can open the webapp and check by yourself.

import { db } from '@/lib/db'

  • what value do you get form this “db” in vercel logs? try to debug this to see if vercel is getting correct value
  • or try to “clean” your cookies, maybe earlier “values” are conflicting

did you try “re-deploying” it? maybe that could help if all those dubug steps produces correct response or not

happy coding :slight_smile:

Let me check the log to see what db gives the value.

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