{"id":715,"hash":"3f77c20eee6a705fa9069bb8a4d1ec97949f5a6dd9b05161895dc59cbb7c42f0","pattern":"next-auth credentials provider authorize type error","full_message":"Problem\nI am only using a single CredentialsProvider in next-auth but I'm confused about how to handle async authorize() with a custom user interface.\n\nI defined the user interface in types/next-auth.d.ts as follows:\n\nimport NextAuth from \"next-auth\"\n\ndeclare module \"next-auth\" {\n  interface User {\n    id: string\n    address: string\n    name?: string\n  }\n}\n\nThis is the provider definition in [...nextauth].ts:\n\nCredentialsProvider({\n  name: \"Ethereum\",\n  credentials: {\n    message: {\n      label: \"Message\",\n      type: \"text\",\n    },\n    signature: {\n      label: \"Signature\",\n      type: \"text\",\n    },\n  },\n  async authorize(credentials) {\n    try {\n      const nextAuthUrl = process.env.NEXTAUTH_URL\n      if (!nextAuthUrl) return null\n      if (!credentials) return null\n\n      // [verify the credential here]\n      // \"message\" contains the verified information\n\n      let user = await prisma.user.findUnique({\n        where: {\n          address: message.address,\n        },\n      })\n      if (!user) {\n        user = await prisma.user.create({\n          data: {\n            address: message.address,\n          },\n        })\n      }\n\n      return {\n        id: user.id,\n        address: user.address,\n        name: user.name\n      }\n    } catch (e) {\n      console.error(e)\n      return null\n    }\n  },\n})\n\nNow I see the typescript error in the async authorize(credentials)\n\nType '(credentials: Record<\"message\" | \"signature\", string> | undefined) => Promise<{ id: string; address: string; name: string | null; } | null>' is not assignable to type '(credentials: Record<\"message\" | \"signature\", string> | undefined, req: Pick<RequestInternal, \"body\" | \"query\" | \"headers\" | \"method\">) => Awaitable<...>'.\n  Type 'Promise<{ id: string; address: string; name: string | null; } | null>' is not assignable to type 'Awaitable<User | null>'.\n    Type 'Promise<{ id: string; address: string; name: string | null; } | null>' is not assignable to type 'PromiseLike<User | null>'.\n      Types of property 'then' are incompatible.\n        Type '<TResult1 = { id: string; address: string; name: string | null; } | null, TResult2 = never>(onfulfilled?: ((value: { id: string; address: string; name: string | null; } | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | unde...' is not assignable to type '<TResult1 = User | null, TResult2 = never>(onfulfilled?: ((value: User | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.\n          Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.\n            Types of parameters 'value' and 'value' are incompatible.\n              Type '{ id: string; address: string; name: string | null; } | null' is not assignable to type 'User | null'.\n                Type '{ id: string; address: string; name: string | null; }' is not assignable to type 'User'.\n                  Types of property 'name' are incompatible.\n                    Type 'string | null' is not assignable to type 'string | undefined'.\n                      Type 'null' is not assignable to type 'string | undefined'.\n\nDocs\nCredentials provider\n\nNextAuth with typescript/extend interface","ecosystem":"npm","package_name":"typescript","package_version":null,"solution":"As stated on GitHub TypeScript error for the Credentials provider #2701 the current fix for this issue is to set strict to false (\"strict\": false) in the tsconfig.json file. The reason for this is that NextAuth.js was developed using \"strict\": false but they are currently working on it to become compatible with strict set to true.","confidence":0.85,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/74089665/next-auth-credentials-provider-authorize-type-error","votes":13,"created_at":"2026-04-19T04:51:32.038772+00:00","updated_at":"2026-04-19T04:51:32.038772+00:00"}