next auth v5 i'm getting a `invalid_grant`
when i use google provider
here's my auth code
export const providers: Provider[] = [
GoogleProvider({
clientId: process.env.AUTH_GOOGLE_ID || "",
clientSecret: process.env.AUTH_GOOGLE_SECRET || "",
checks: ["none"],
}),
{
id: "email",
type: "email",
name: "Email",
sendVerificationRequest: async ({ identifier: email, url }: any) => {
// const siteSettings = await getSiteConfig();
const { host } = new URL(url);
// @ts-ignore
await sendMailApi({
html: html({ email, url }),
subject: `Sign in to ${host}`,
text: text({ email, url }),
to: email,
});
},
} as any,
];
export const authOptions: NextAuthConfig = {
// @ts-ignore
adapter: PrismaAdapter(prisma),
callbacks: {
session: async ({ session, user }) => {
if (session.user) {
session.user = user;
session.user.userId = user.id;
session.user.stripeId = user.stripeId;
}
return session;
},
},
// debug: !(process.env.NODE_ENV === "production"),
providers,
secret: process.env.NEXTAUTH_SECRET,
session: {
strategy: "jwt",
maxAge: 24 * 3600,
},
// pages: {
// signIn: "/auth/login",
// },
};
export const providers: Provider[] = [
GoogleProvider({
clientId: process.env.AUTH_GOOGLE_ID || "",
clientSecret: process.env.AUTH_GOOGLE_SECRET || "",
checks: ["none"],
}),
{
id: "email",
type: "email",
name: "Email",
sendVerificationRequest: async ({ identifier: email, url }: any) => {
// const siteSettings = await getSiteConfig();
const { host } = new URL(url);
// @ts-ignore
await sendMailApi({
html: html({ email, url }),
subject: `Sign in to ${host}`,
text: text({ email, url }),
to: email,
});
},
} as any,
];
export const authOptions: NextAuthConfig = {
// @ts-ignore
adapter: PrismaAdapter(prisma),
callbacks: {
session: async ({ session, user }) => {
if (session.user) {
session.user = user;
session.user.userId = user.id;
session.user.stripeId = user.stripeId;
}
return session;
},
},
// debug: !(process.env.NODE_ENV === "production"),
providers,
secret: process.env.NEXTAUTH_SECRET,
session: {
strategy: "jwt",
maxAge: 24 * 3600,
},
// pages: {
// signIn: "/auth/login",
// },
};
1 Reply
nvm it worked after removing
strategy: "jwt"
and checks: ["none"],