如何解决API 已解析但未发送对 /api/auth/callback/credentials 的响应,这可能会导致请求停滞
当我尝试使用 Talend API Tester
登录时,将其输入终端:
API resolved without sending a response for /api/auth/callback/credentials,this may result in stalled requests.
此外,这是请求的图像:
我关注了这个:Next-Auth.js -> Rest API
为什么我会收到这种回应和警告?
下面是 [..nextauth.js]
文件的代码。我的代码有什么问题?
import NextAuth from 'next-auth'
import Providers from 'next-auth/providers'
import prisma from '../../../lib/prisma'
const options = {
providers: [
Providers.Credentials({
name: 'Credentials',credentials: {
email: { label: "Email",type: "email",placeholder: "something@example.com" },password: { label: "Password",type: "password" }
},async authorize(credentials) {
const {email,password} = credentials
const user = await prisma.user.findFirst({ where: { email,password } })
console.log(user);
// If no error and we have user data,return it
if (user) {
return user
}
// Return null if user data could not be retrieved
return null
}
})
]
}
export default async function handle(req,res) {
console.log('I see');
NextAuth(req,res,options)
}
注意:实际上我不想在正文中发送 csrfToken
。只有 email
& password
到端点。请看看我的这个问题 How to do authentication using NextAuth.js without login page (using postman)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。