Search code examples
jwtazure-active-directoryasp.net-core-2.1

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 error is:

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://.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.


Solution

  • Solved it by replacing, in appsettings.json :

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

    To

    "AzureAd": {
         "Instance": "https://login.microsoftonline.com/",
    ...
    }