β Auth0 and ASP.NET API
Hello
I have difficulties while trying to implement Auth0 in ASP.NET API. I tried many things.
Currently, I am doing it all over again but with simpler applications to understand what is wrong with my configurations.
So I created a new ASP.NET API to try to reach an endpoint with the attribute [Authorize].
My API Controller looks like this: https://paste.mod.gg/vrwcfkvfpexf/0
And my configuration looks like this :
https://paste.mod.gg/yoyyytvmdcwk/0
So if I try to reach the endpoint with Postman here :
https://localhost:7113/api/AuthTest/private
With a Bearer Token that I copy from my "Test API endpoint" in Auth UI (you can see the image below)
Then I receive this response in Postman :
"
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://philauth.eu.auth0.com/.well-known/openid-configuration'.
---> System.TypeLoadException: Could not load type 'Microsoft.IdentityModel.Json.JsonConvert' from assembly 'Microsoft.IdentityModel.Tokens, Version=7.0.2.0, Culture=neutral, PublicKeyToken=(IChangedThisBecauseIdkIfThisIsSensitive)'.
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.Microsoft.IdentityModel.Protocols.IConfigurationRetriever<Microsoft.IdentityModel.Protocols.
"
I thought my API could not reach the endpoint, so I made the "OpenIdConfig" endpoint in the controller but I can reach it with no problem. So I really don't know?
Does someone have an idea to see where the error comes from, or how to debug it? Please
I have difficulties while trying to implement Auth0 in ASP.NET API. I tried many things.
Currently, I am doing it all over again but with simpler applications to understand what is wrong with my configurations.
So I created a new ASP.NET API to try to reach an endpoint with the attribute [Authorize].
My API Controller looks like this: https://paste.mod.gg/vrwcfkvfpexf/0
And my configuration looks like this :
https://paste.mod.gg/yoyyytvmdcwk/0
So if I try to reach the endpoint with Postman here :
https://localhost:7113/api/AuthTest/private
With a Bearer Token that I copy from my "Test API endpoint" in Auth UI (you can see the image below)
Then I receive this response in Postman :
"
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://philauth.eu.auth0.com/.well-known/openid-configuration'.
---> System.TypeLoadException: Could not load type 'Microsoft.IdentityModel.Json.JsonConvert' from assembly 'Microsoft.IdentityModel.Tokens, Version=7.0.2.0, Culture=neutral, PublicKeyToken=(IChangedThisBecauseIdkIfThisIsSensitive)'.
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.Microsoft.IdentityModel.Protocols.IConfigurationRetriever<Microsoft.IdentityModel.Protocols.
"
I thought my API could not reach the endpoint, so I made the "OpenIdConfig" endpoint in the controller but I can reach it with no problem. So I really don't know?
Does someone have an idea to see where the error comes from, or how to debug it? Please

A tool for sharing your source code with the world!
A tool for sharing your source code with the world!