Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
23 replies
fotoflo

nextAuth - Add to the user model

https://next-auth.js.org/adapters/models

Hello, I'd like to add modify the user before it comes into the session callback in [..nextauth]

  callbacks: {
    async session({ session, user }) {
      if (session.user) {
        session.user.id = user.id;
      }


I found this but the authorize method never gets called:
https://stackoverflow.com/questions/71185287/pass-more-data-to-session-in-next-auth

is it a bad idea to overoptimze this and i should just make an extra prisma call here?
NextAuth.js can be used with any database. Models tell you what structures NextAuth.js expects from your database. Models will vary slightly depending on which adapter you use, but in general, will look something like this. Each adapter's model/schema will be slightly adapted for its needs, but will look very much like this schema below:
Stack Overflow
We are doing OTP auth in our website. So in order to get authorized, a visitor enter his phone number in input and we send him a OPT number and he again enters the sent opt, then if it matches, we ...
Pass more data to session in Next-auth
Was this page helpful?