Relative Content

Tag Archive for next.jsnext-auth

How can I redirect the first user in next-auth and store the session information?

I implemented Google OAuth login using next-auth. In the async signIn function, I query the database with the getUser function, and if it is the first time the user logs in, I redirect them to the /sign-up page. However, on the /sign-up page, I found that the session was null. I considered using an adapter, but it would create many tables in the database. I want to minimize the values stored in the database.

How can I update the Session info on Every Refresh?

I have an admin portal where the admin can edit other users’ names. However, if a user is already logged in with the name “John” and their name is updated to “Michael,” the change doesn’t reflect properly in NextAuth session.