admin管理员组文章数量:1309947
I'm getting a server error with next-auth. I believe I used [...nextauth].js correctly but it's saying my () after my providers is incorrect.
here is the file my error is happening
⨯ TypeError: next_auth_providers_credentials__WEBPACK_IMPORTED_MODULE_1__ is not a function at CredentialsProvider (src\auth.js:9:4)
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [
CredentialsProvider({
credentials: {
username: { label: "Username", type: "text" },
password: { label: "Password", type: "password" },
},
authorize: async (credentials) => {
const { username, password } = await loginSchema.parseAsync(
credentials
);
const user = await getUserFromDb(username);
if (!user) throw new Error("Nom d'utilisateur introuvable.");
const isValidPassword = await bcryptpare(password, user.password);
if (!isValidPassword) {
throw new Error("Identifiants incorrects.");
}
return user;
},
}),
],
session: {
strategy: "jwt",
maxAge: 7 * 24 * 3600,
},
callbacks: {
async session({ session, token }) {
return { ...session, ...token };
},
async jwt({ token, user }) {
return { ...token, ...user };
},
},
basePath: "/api/auth",
secret: process.env.NEXTAUTH_SECRET,
});
本文标签: next authnextauthproviderscredentialsWEBPACKIMPORTEDMODULE1 is not a functionStack Overflow
版权声明:本文标题:next auth - next_auth_providers_credentials__WEBPACK_IMPORTED_MODULE_1__ is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741859631a2401546.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论