过去几天我收到一个奇怪的错误。无法使用凭据验证我的 Next.js 应用程序。
据我所知,根据文档,一切都是正确的。
我也无法在 Chrome 开发工具中看到网络请求。
import NextAuth from "next-auth";
import CredentialProvider from "next-auth/providers/credentials";
import { signOut,useSession,signIn } from 'next-auth/react';
import { axios } from 'axios';
import { API_URL } from "../../../helpers/api/mutations";
export default NextAuth({
providers: [
CredentialProvider({
name: "credentials",
credentials: {
username: {
label: "Email",
type: "text",
placeholder: "mani@test.com"
},
password: {
label: "Password",
type: "password"
}},
// My authorize function where I called my graphql mutation for token and session.
async authorize(credentials,req) {
const {data} = await …Run Code Online (Sandbox Code Playgroud)