More than one credential Provier next-auth
Answered
Naeemgg posted this in #help-forum
NaeemggOP
If we are using more than one cred provider how can we mention its id in
source: https://next-auth.js.org/providers/credentials#:~:text=You%20can%20specify%20more%20than%20one%20credentials%20provider,in%20page.%20%2F%2A%20...%20additional%20providers%20...%20%2F%2A%2F
SignIn()
function??providers: [
CredentialsProvider({
id: "domain-login",
name: "Domain Account",
async authorize(credentials, req) {
const user = {
/* add function to get user */
}
return user
},
credentials: {
domain: {
label: "Domain",
type: "text ",
placeholder: "CORPNET",
value: "CORPNET",
},
username: { label: "Username", type: "text ", placeholder: "jsmith" },
password: { label: "Password", type: "password" },
},
}),
CredentialsProvider({
id: "intranet-credentials",
name: "Two Factor Auth",
async authorize(credentials, req) {
const user = {
/* add function to get user */
}
return user
},
credentials: {
username: { label: "Username", type: "text ", placeholder: "jsmith" },
"2fa-key": { label: "2FA Key" },
},
}),
/* ... additional providers ... /*/
]
source: https://next-auth.js.org/providers/credentials#:~:text=You%20can%20specify%20more%20than%20one%20credentials%20provider,in%20page.%20%2F%2A%20...%20additional%20providers%20...%20%2F%2A%2F
2 Replies
NaeemggOP
Got the answer here
https://github.com/nextauthjs/next-auth/discussions/8937
https://github.com/nextauthjs/next-auth/discussions/8937
NaeemggOP
we just need to pass the id instead of credentials
SignIn("id")
Answer