NextAuth Update data
Answered
Large garden bumble bee posted this in #help-forum
Large garden bumble beeOP
Hello everyone,
Iˇm using the latest NextJS, NextAuth, Prisma (Postgre) and the app directory.
Everything is working, but it seems like the data from the provider (I use only DiscordProvider) in the database isn't updated. I tried changing my display name on discord and that resulted in the new display name showing in the profile() function and it is returned but the data in the database is not updated nor is the session callback data.
My question is how do i update the data? Do i really have to check & update the outdated data myself using prisma?
Iˇm using the latest NextJS, NextAuth, Prisma (Postgre) and the app directory.
Everything is working, but it seems like the data from the provider (I use only DiscordProvider) in the database isn't updated. I tried changing my display name on discord and that resulted in the new display name showing in the profile() function and it is returned but the data in the database is not updated nor is the session callback data.
My question is how do i update the data? Do i really have to check & update the outdated data myself using prisma?
Answered by fuma
It is an expected behaviour. Next Auth won't update the profile since the user had been created in the database.
You have to manually update it.
Note: The display name won't be updated instantly on client side. It's stored in a JWT token and you might need to revalidate it.
You have to manually update it.
Note: The display name won't be updated instantly on client side. It's stored in a JWT token and you might need to revalidate it.
2 Replies
Large garden bumble beeOP
(bump)
@Large garden bumble bee Hello everyone,
Iˇm using the latest NextJS, NextAuth, Prisma (Postgre) and the app directory.
Everything is working, but it seems like the data from the provider (I use only DiscordProvider) in the database isn't updated. I tried changing my display name on discord and that resulted in the new display name showing in the profile() function and it is returned but the data in the database is not updated nor is the session callback data.
My question is how do i update the data? Do i really have to check & update the outdated data myself using prisma?
It is an expected behaviour. Next Auth won't update the profile since the user had been created in the database.
You have to manually update it.
Note: The display name won't be updated instantly on client side. It's stored in a JWT token and you might need to revalidate it.
You have to manually update it.
Note: The display name won't be updated instantly on client side. It's stored in a JWT token and you might need to revalidate it.
Answer