Replies: 2 comments
-
For now I found a workaround. A bit complex but it works.
This ensures that both OAuth and magic links work the same. Also, the database persistence ensures that even if user uses different browsers during signIn, the accountType is set correctly. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Any better way has come about as yet? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm having a use-case where I have 2 different user types (with separate signIn ui flows) - e.g. Company and Employee.
My setup is Next13, next-auth 4 and Prisma with Postgresql.
I added an
accountType
field to my User schema. And I would like to populate it with the corresponding Company/Employee account type during first signIn.I'm using OAuth providers sign in as well as Email (magic link) sign in. So, passing additional accountType data is required for all sign-ins.
So far, I found a way to pass additional parameters to
signIn
function using the third argument which is then parsed in auth handler as query parameters (using Advanced Initialization from docs).But that's pretty much where I got stuck and not sure how to proceed with creating user with that additional accountType field.
Potentially, if there's no simpler solution, I assume I could override the default signIn flow as a whole using auth handler but that seems a bit too complex for that task.
That seems like a common task, so I might be missing some simpler flow.
So, question is - how to pass additional user data to be saved in DB from signIn to createUser?
Beta Was this translation helpful? Give feedback.
All reactions