0
votes

I setup Azure B2C and a custom policy, in Azure portal it states the discovery endpoint is:

https://TENANT_NAME.b2clogin.com/TENANT_NAME.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_signup_signin

However, when setting it up via OpenId library (Microsoft.AspNetCore.Authentication.OpenIdConnect):

builder.AddOpenIdConnect(openIdProvider.IdentityProviderId, openIdProvider.IdentityProviderName,
options =>
{
    options.SignInScheme = Constants.SignInScheme;
    options.SignOutScheme = IdentityServerConstants.SignoutScheme;
    options.Authority = "https://TENANT_NAME.b2clogin.com/TENANT_NAME.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_signup_signin"
    options.ClientId = openIdProvider.OpenIdClientId;
    options.ClientSecret = openIdProvider.OpenIdClientSecret;
})

I get the following error:

InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://TENANT_NAME.b2clogin.com/TENANT_NAME.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1A_signup_signin/.well-known/openid-configuration'.

For some reason it's appending "/.well-known/openid-configuration", this work perfectly fine with Azure AD because I am not using a query string param. I assume the library is appending that string because the url doesn't end with "/.well-known/openid-configuration".

Is there a way to fix this? Or force OpenId to use the actual URL I specified?

Is there anyway to fix this? I have to use 2.2.0 (https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.OpenIdConnect/2.2.0) of the library.

1

1 Answers

1
votes

You can use the alternative url format which works well if you use "pure" OpenIdConnect.

// Authority
https://tenant_name.b2clogin.com/TENANT_NAME.onmicrosoft.com/B2C_1A_signup_signin/v2.0/

// OpenIdConnect Config URL
https://tenant_name.b2clogin.com/TENANT_NAME.onmicrosoft.com/B2C_1A_signup_signin/v2.0/.well-known/openid-configuration