'next-auth' with google question
Hello my dear developer!
I'm calling for your help. This topic is new to me, please be a bit lenient with me. Also it's my first post on Reddit! Getting grilled would ruin my day. Thank you very much :-)
I’m using 'next-auth' to let users sign up with google. This works. I get the user
and account
data back from google inside the signIn
callback in the [...nextauth].ts
file. With this information I create a user profile on my backend service.
Snippet 1: perfectly working signIn callback with next-auth
However I have two different types of users: athletes
and organisers
. They use separate forms to sign up on the same website. I would like to let both athletes
and organisers
sign up with google. But how do I get this information to the signIn callback from "Snipped 1"?
My approach was to pass this information through the authorizationParams
in the signIn method.
Snippet 2: Button that passes the userType as authorizationParams
This now brings me the userType at least to the URL as a parameter in the oauth consent screen
. But if I select an account now: How I can work with this userType now in my signIn callback? How do I get this parameter back to my application?
Snipped 3: Google oauth consent
Any help would be so much appreciated. I googled the half web for an answer and couldn't find an answer. Maybe I'm searching for the wrong things. I'm lost. Help me. Please :D