api解析时未发送/api/auth/callback/credentials响应,这可能会导致请求暂停

ct3nt3jp  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(271)

当我尝试使用 Talend API Tester ,将其放入终端: API resolved without sending a response for /api/auth/callback/credentials, this may result in stalled requests. 此外,以下是请求的图像:

我遵循以下步骤:next-auth.js->restapi
为什么我会得到这样的回应和警告?
以下是 [..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 到终点。请看看我的这个问题,如何在没有登录页面的情况下使用nextauth.js进行身份验证(使用postman)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题