Next.js Discord

Discord Forum

Regarding Google Auth: signin with a different google account

Answered
Blue orchard bee posted this in #help-forum
Open in Discord
Blue orchard beeOP
So:
- I implemented Google Auth on my Next App.
- No Adapter
- I sign out
- I sign in again

Everything is working fine up until this stage.

My question is:
When i click on SignIn again, i am immediately signed in with the previous google account,
but i want to be able to change accounts even if my browser has just one google account registered,
i mean,
always show the Google Authorization Screen (in screenshot) and i can't figure out how.

Any help would be appreciated
Answered by riský
i don't know what you are using, but i believe that using prompt=consent can do it: https://developers.google.com/identity/openid-connect/openid-connect#re-consent
View full answer

2 Replies

i don't know what you are using, but i believe that using prompt=consent can do it: https://developers.google.com/identity/openid-connect/openid-connect#re-consent
Answer
Blue orchard beeOP
@riský, sorry for the late reply, i hadn't had the time to look into it.

It did work, using next-auth, we can set it up like this:

export const authOptions = {
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_AUTH_CLIENT_ID,
      clientSecret: process.env.GOOGLE_AUTH_CLIENT_SECRET,
      authorization: {
        params: {
          prompt: 'consent',
        },
      },
    }),
  ],