I know this question has been answered, but I don't understand what people exactly do (about certificates, ssl) and they all use a localhost but not me.
I used this sample as my example OpenIdConnect
I'm using:
Both are using .Net Core 2.1. The Web App is using the Azure AD connection to get a JwtBearer token, that is sent to the API.
Seeing the route /api/information
in the API, a request is sent from the Web App to the API, and the API is returning the error above.
The exact error is:
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://<mycompany>.onmicrosoft.com/<big Guid of 72 chars>/.well-known/openid-configuration'.
So I tried to solve this error, by adding certificates, adding the neccessary libraries (System.Net.Http
v4.3.3), checked every permission in Azure AD but none of these worked.
If you need more information, I can provide them by adding them in this post.
If anyone has this issue and is using the Azure B2C the instance is your root url for your azure b2c tenant. e.g. https://myroot.b2clogin.com/. The domain should be: myroot.onmicrosoft.com/
Make sure there is no https in the domain.
This worked for me.
{
"AzureADB2C": {
"CallbackPath": "/signin-oidc",
"ClientId": "<app-registration-app-client-id>",
"ClientSecret": "<secret-value>",
"Domain": "<domain-name>.onmicrosoft.com/",
"EditProfilePolicyId": "B2C_1_profile",
"Instance": "https://<domain-name>.b2clogin.com/",
"ResetPasswordPolicyId": "B2C_1_reset",
"SignUpSignInPolicyId": "B2C_1_signupsignin"
}
}
Solved it by replacing, in appsettings.json
:
"AzureAd": {
"Instance": "<APP_Uri_from_Azure_Portal>",
...
}
To
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
...
}
Resolved the issue by adding below code in Startup-->Configure
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With