1

I'm using NextAuth JS CredentialsProvider in TypeScript but I got this error..

This expression is not callable.
Type 'typeof import("/Users/developer/nextjs-project/test/node_modules/next-auth/providers/index")' has no call signatures.ts(2349)

enter image description here

Sample code from NextAuth

CredentialsProvider({
      name: "Credentials",
      credentials: {
        username: { label: "Username", type: "text", placeholder: "jsmith" },
        password: { label: "Password", type: "password" }
      },
      async authorize(credentials, req) {
        const user = { id: "1", name: "J Smith", email: "[email protected]" }

        if (user) {
          return user
        } else {
          return null
        }
      }
    })

1 Answer 1

1

your import is incorrect you are importing from next-auth/providers. it is rather from next-auth/providers/credentials :

import CredentialsProvider from "next-auth/providers/credentials";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.