小编roo*_*ooo的帖子

下一个身份验证凭据提供程序授权类型错误

问题

我只在下一个身份验证中使用一个CredentialsProvider,但我对如何处理async authorize()自定义用户界面感到困惑。

我定义用户界面如下types/next-auth.d.ts

import NextAuth from "next-auth"

declare module "next-auth" {
  interface User {
    id: string
    address: string
    name?: string
  }
}

Run Code Online (Sandbox Code Playgroud)

这是提供者定义[...nextauth].ts

CredentialsProvider({
  name: "Ethereum",
  credentials: {
    message: {
      label: "Message",
      type: "text",
    },
    signature: {
      label: "Signature",
      type: "text",
    },
  },
  async authorize(credentials) {
    try {
      const nextAuthUrl = process.env.NEXTAUTH_URL
      if (!nextAuthUrl) return null
      if (!credentials) return null

      // [verify the credential here]
      // "message" contains the verified information …
Run Code Online (Sandbox Code Playgroud)

typescript next.js prisma next-auth

11
推荐指数
2
解决办法
8284
查看次数

标签 统计

next-auth ×1

next.js ×1

prisma ×1

typescript ×1