TTC
Theo's Typesafe Cultdjamel8907
NextAuth sign in function not working properly
hey, i have nextauth set up with
credentialsProvider
on, i have the following onClick on a button:
however when i click on the button, the authorize function on the nextauth route doesn't get called( i put in some console logs to see it called)
any idea why?
note: i did add my own signIn page in the nextauth config
note2: it works just fine when i use the predfined sign in page
nextauth config:
import dbPromise from "@/modules/db";
import NextAuth from "next-auth/next";
import GoogleProvider from "next-auth/providers/google";
import CredentialsProvider from "next-auth/providers/credentials";
const handler = NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
CredentialsProvider({
name: "Credentials",
credentials: {
email: {
label: "Email",
type: "email",
placeholder: "example@example.com",
},
password: { label: "Password", type: "password" },
},
async authorize({ email, password }) {
console.log("next auth authorize function called");
try {
if (!email || !password) {
return null;
}
const dbUser = await (await dbPromise)
.db("auth")
.collection("users")
.findOne({ email });
if (dbUser && dbUser.password === password) {
return dbUser;
}
} catch (error) {
console.error(
"NEXT_AUTH_ERROR, this error happened during the authorize function",
error
);
}
console.log("next auth authorized function done");
},
}),
],
pages: {
signIn: "/login",
},
});
export const GET = handler;
export const POST = handler;21KMembers
View on DiscordWant results from more Discord servers?
More PostsFetching only onceso i have an authToken being stored in the local storage and i want to send it in a POST request eacimport mysql into planetscaleHas anyone imported a database from your local pc into planetscale? With regard to the hostname whatPromise.all is not working in transaction in drizzleCan anyone tell me why this transaction is not working in drizzle?
it does not throwing any error bshortest import path with eslint + tsconfig.json pathsIs there any way to configure eslint (I am using `eslint-plugin-import` + `eslint-import-resolver-ty