Sudden Microsoft Identity error IDX20803

Alex D 16 Reputation points
2022-12-07T12:46:50.753+00:00

Hello.

All of a sudden I am no longer able to log into my ASP.NET web api on localhost.

I've been getting this error:

    System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.windows.net/578XXXXXX/v2.0/.well-known/openid-configuration'.  
     ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://login.windows.net/578XXXXXX/v2.0/.well-known/openid-configuration'.  
     ---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.  
     ---> System.TimeoutException: A task was canceled.  
     ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.  
       at ........  

My configuration is correct:

  "AzureAd": {  
    "Instance": "https://login.windows.net",  
    "ClientId": "2103XXXXXXX",  
    "TenantId": "57XXXXXXX",  
    "Audience": "api://21XXXXX"  
  },  

My code in Startup:

    builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)  
       .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));  

All this worked perfectly fine until today.

There are no problems in production. The same code works perfectly in the deployed Azure App.

Any ideas why I'm getting this time out issue? Could it be a network issue on my end?

Microsoft Security | Microsoft Entra | Microsoft Entra ID

6 answers

Sort by: Newest
  1. Shubham Gupta 0 Reputation points
    2026-09-15T18:21:17.9533333+00:00

    hello
    I got the same issue

    Was this answer helpful?

    0 comments No comments

  2. Ryan Brown 45 Reputation points
    2024-12-09T14:54:04.0733333+00:00

    I have the same issue sometimes. Rebooting always works. So today I just tried turning off my wifi and reconnecting and that also fixed it.

    Weird.

    Was this answer helpful?

    1 person found this answer helpful.

  3. Prasad, Raji 10 Reputation points
    2023-12-08T10:10:37.9133333+00:00

    The app was referencing an expired SSL certificate from the server (VM in azure) and when we removed the expired certificate the issue got resolved.

    Was this answer helpful?

    0 comments No comments

  4. Anonymous
    2023-12-08T10:02:51.38+00:00

    Hello,

    We got the same issue in environments (DEV and Production) on my side.

    So do we have any solution for this?

    IDX20803: Unable to obtain configuration from: 'https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize&api-version=1.1'. IDX20804: Unable to retrieve document from: 'https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https://login.microsoftonline.com/common/oauth2/v2.0/authorize&api-version=1.1'. An error occurred while sending the request. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.. An existing connection was forcibly closed by the remote host. 
    

    Was this answer helpful?

    0 comments No comments

  5. Karol Grodzicki 15 Reputation points
    2023-06-21T09:47:03.8866667+00:00

    We had the same issue in .NET 7 application. It was fixed by updating Microsoft.Identity.Web package to 2.12.4 (previously was 2.5.0)

    Was this answer helpful?

    3 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.