Next.js Discord

Discord Forum

NextAuthJS session old value update

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
I created a project with Google Login, now I made copy of that project and start using credential login.

Login is happing perfectly, but session variable are form google login. Even though i am not using google login.

Here is my options.js (i am using app router)
import CredentialsProvider from "next-auth/providers/credentials"

const authOptions = {
  providers: [
    CredentialsProvider({
      name: 'Nothing',
      credentials: {
        userid: { label: "User ID", type: "text", placeholder: "Your ID" },
        password: { label: "Password", type: "password", placeholder: "Your Password" }
      },
      async authorize(credentials) {        
        const user = { id: "69", userid: "myid", username: "myname", password: "pass" }

        if (credentials?.userid === user.userid && credentials?.password === user.password) {
          return user
        } 
        
        return null
      }
    })
  ],
  secret: process.env.NEXTAUTH_SECRET,
  session: {
    strategy: 'jwt',
  },
}

export default authOptions;


Value of user in session
session {
  user: {
    name: undefined,
    email: undefined,
    image: undefined,
  },
  expires: Date,
  accessToken: undefined
} 

0 Replies