I want to authenticate using NextAuth and IdentityServer4. I have created the following provider:
import NextAuth from "next-auth"
import IdentityServer4Provider from "next-auth/providers/identity-server4";
export default NextAuth({
// Configure one or more authentication providers
providers: [
IdentityServer4Provider({
id: "identity-server4",
name: "IdentityServer4",
authorization: { params: { scope: "openid profile email api phone offline_access" } },
issuer: "https://localhost:4445/connect/token",
clientId: "clientId",
clientSecret: "clientSecret"
})
],
})
The problem I am having is I need to add a username and password to this setup.
When I look at the code for IdentityServer4 provider in NextAuth, I found this (no username nor password fields):
/** @type {import(".").OAuthProvider} */
export default function IdentityServer4(options) {
return {
id: "identity-server4",
name: "IdentityServer4",
type: "oauth",
wellKnown: `${options.issuer}/.well-known/openid-configuration`,
authorization: { params: { scope: "openid profile email" } },
checks: ["pkce", "state"],
idToken: true,
profile(profile) {
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: null,
}
},
options,
}
}
How can I add this to the provider?