Skip to content

Commit 042955e

Browse files
committedJul 16, 2022
fix(providers): allow issuer in Azure AD B2C
1 parent 82e107c commit 042955e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎packages/next-auth/src/providers/azure-ad-b2c.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ export interface AzureB2CProfile extends Record<string, any> {
1919

2020
export default function AzureADB2C<P extends AzureB2CProfile>(
2121
options: OAuthUserConfig<P> & {
22-
primaryUserFlow: string
23-
tenantId: string
22+
primaryUserFlow?: string
23+
tenantId?: string
2424
}
2525
): OAuthConfig<P> {
2626
const { tenantId, primaryUserFlow } = options
27+
const issuer =
28+
options.issuer ??
29+
`https://${tenantId}.b2clogin.com/${tenantId}.onmicrosoft.com/${primaryUserFlow}/v2.0`
2730
return {
2831
id: "azure-ad-b2c",
2932
name: "Azure Active Directory B2C",
3033
type: "oauth",
31-
wellKnown: `https://${tenantId}.b2clogin.com/${tenantId}.onmicrosoft.com/${primaryUserFlow}/v2.0/.well-known/openid-configuration`,
34+
wellKnown: `${issuer}/.well-known/openid-configuration`,
3235
idToken: true,
3336
profile(profile) {
3437
return {

0 commit comments

Comments
 (0)