Skip to content

Send additional parameters on SignIn() with GoogleProvider #4094

Answered by zanzlender
zanzlender asked this question in Help
Discussion options

You must be logged in to vote

UPDATE

I found the answer, in case anyone encounters this as well.

As per the docs Next-Auth Additional Parameters I added my parameter inside Google's authorization parameter, like so:

GoogleProvider({
        clientId: process.env.GOOGLE_CLIENT_ID,
        clientSecret: process.env.GOOGLE_CLIENT_SECRET,
        authorization: {
          params: {
            prompt: "consent",
            access_type: "offline",
            response_type: "code",
            userType: "user" || "admin",  <-- THIS ONE
          },
        },
      }),

The problem was that the additional parameters don't arrive in the signIn callback, where I run my logic, and I didn't feel like creating my own file for…

Replies: 10 comments 30 replies

Comment options

You must be logged in to vote
16 replies
@VictorKolb
Comment options

@nimeshvaghasiya
Comment options

@nimeshvaghasiya
Comment options

@VictorKolb
Comment options

@mkilincaslan
Comment options

Answer selected by zanzlender
Comment options

You must be logged in to vote
7 replies
@khuezy
Comment options

@ofir-shapira-como
Comment options

@khuezy
Comment options

@shamoons
Comment options

@khuezy
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@khuezy
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@khuezy
Comment options

Comment options

You must be logged in to vote
3 replies
@davidreis97
Comment options

@drattansingh
Comment options

@xcaeser
Comment options

Comment options

You must be logged in to vote
1 reply
@khuezy
Comment options

Comment options

You must be logged in to vote
1 reply
@xcaeser
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet