Relative Content

Tag Archive for next.jsazure-active-directoryprismanext-auth

set user id manually with prisma adapter in next-auth

I use next.js with next-auth. I use the AzureAD provider. Now I want to store the user data in my own database, since Azure AD sucks really hard in performance. When a user logs in the first time I want to store the name and the image in my database. To do so I add the prisma adapter for next-auth and added the function profile to the azure provider which handles the returned data of the user. There I hand over the ID of the AzureProfile of this user. But prisma will always ignore the ID field and let the database create the ID.
All the other fields are no problem. They are stored in the database as I define them in the returned object. Only the ID is a problem.