Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDX20803: Unable to obtain configuration from

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:

  • A web app
  • A web API

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.

like image 927
RamenTurismo Avatar asked Jun 07 '18 13:06

RamenTurismo


3 Answers

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"
    }
}
like image 184
Amir Ali Avatar answered Nov 12 '22 07:11

Amir Ali


Solved it by replacing, in appsettings.json :

"AzureAd": {
     "Instance": "<APP_Uri_from_Azure_Portal>",
...
}

To

"AzureAd": {
     "Instance": "https://login.microsoftonline.com/",
...
}
like image 39
RamenTurismo Avatar answered Nov 12 '22 07:11

RamenTurismo


Resolved the issue by adding below code in Startup-->Configure

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls 
                                       | SecurityProtocolType.Tls11
                                       | SecurityProtocolType.Tls12
                                       | SecurityProtocolType.Ssl3;
like image 5
Ramdas Chavan Avatar answered Nov 12 '22 08:11

Ramdas Chavan