NextAuth
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Hello, I have a problem, when I signIn with NextAuth then I signOut and resignIn with a different account it register me with the first account. I try to change my navigator and others things but nothing.
import NextAuth, { AuthOptions } from "next-auth";
import GoogleProvider from "next-auth/providers/google";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
export const authOptions: AuthOptions = {
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
],
callbacks: {
async session({ session, token }) {
if (session?.user && token?.sub) {
session.user.id = token.sub;
}
return session;
},
async redirect({ url, baseUrl }) {
return "/sub"; // Redirige toujours vers "/sub" après la connexion
},
},
};
export default NextAuth(authOptions);