.NET Core Web API & Auth0 IDX20803 error

Hi,

I’m trying out this tutorial: How to Build and Secure Web APIs with ASP.NET Core 3.0

When I test the API with the Bearer token, I got this error instead:

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: ‘[PII is hidden. For more details, see https://aka.ms/IdentityModel/PII.]’.
—> System.IO.IOException: IDX20807: Unable to retrieve document from: ‘[PII is hidden. For more details, see https://aka.ms/IdentityModel/PII.]’. HttpResponseMessage: ‘[PII is hidden. For more details, see https://aka.ms/IdentityModel/PII.]’, HttpResponseMessage.Content: ‘[PII is hidden. For more details, see https://aka.ms/IdentityModel/PII.]’.
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Can you help solve this? Thanks

Hi @adeliab

Check within your appsettings.Development.json file and ensure that the audience value is using https (a secure call) and not http (a unsecure call).

Also, please indicate the version of the Microsoft.AspNetCore.Authentication.JwtBearer nuget package that you are using in your project.

1 Like

hi @curtis.egiftit.admin ,

It’s working now. I’m using postman and when I set the token in the Headers tab, it throws that error. But when I set it in the Authorization tab, then it works.

1 Like

Thanks for sharing that with the rest of community!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.