Next.js Discord

Discord Forum

Next-Auth replacing session with another user session

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Avatar
Polar bearOP
Created 2 users. I login by one user, everything is ok. I login with second user (from another computer), it replaces the session of the first one. And on both computers session of the 2nd user.
How can this be and where to look?

export const authOptions: NextAuthOptions = {
  secret: process.env.NEXTAUTH_SECRET,
  session: {
    strategy: "jwt",
  },
  providers: [
    CredentialsProvider({
      id: "ldap",
      name: "ldap",
      credentials: {
        username: { label: "DN", type: "text", placeholder: "" },
        password: { label: "Password", type: "password" },
      },
      async authorize(credentials) {

        const user = await findUser(credentials.username);

        return new Promise((resolve) => {
          resolve({
            id: `${user.cpf}`,
            name: user.nome,
            email: user.email,
            image: user.foto,
          });
        });
      },
    }),
  ],
  pages: {
    signIn: "/auth/login",
    verifyRequest: "/auth/verify-request",
  },
};

export default NextAuth(authOptions);
Image

0 Replies