Search code examples
c#debugging.net-coreidentityserver4

Troubleshooting Identity Server 4


I am using Identity Server 4 for authentication. I have MVC client. Few days ago i was able to authenticate successfully. But recently i made some changes in Identity Server project which broke something. I am getting

unauthorized_client The client application is not known or is not authorized.

I tried all the possible fixes but couldn't fix it. Is there any way i can debug the code. I could see that the call was made to /connect/authorize endpoint and calls are going to IScopeStore.FindScopesAsync and IClientStore.FindClientByIdAsync and i verified it has all proper AllowedScopes.

Can anyone tell me how do i troubleshoot these kind of issues with Identity Server 4. Also, i am interested to know the execution flow. What IDSvr endpoints are called and when?


Solution

  • your problem can be anything. enable logging to the console and you can find out what it is. Identity Server 4 by default uses the asp.net core logger provider to do its internal logging.

    in your Startup.cs within the Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) method. Add Console logging by loggerFactory.AddConsole(LogLevel.Trace); and make sure that you include the logger extension package in your project.json "Microsoft.Extensions.Logging.Console": "1.0.0",.