Open
Description
Customers can be confused on how to debug web apps. Here we want to go through:
- the most frequent issues (not MFA etc … as it's already handled by the code in Microsoft.Identity.Web): bad client ID, bad secret, secret expired
- Troubleshooting guide
To help debugging the Web App and Web API you could enable:
- the IdentityModelExtension PII: See TodoListService/Startup.cs#L76
See also
https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki/PII
// Since IdentityModel version 5.2.1 (or since Microsoft.AspNetCore.Authentication.JwtBearer version 2.2.0),
// PII hiding in log files is enabled by default for GDPR concerns.
// For debugging/development purposes, one can enable additional detail in exceptions by setting IdentityModelEventSource.ShowPII to true.
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
```
2. put breakpoints in the `JwtODICMiddlewareDiagnostics` class (or the `OJWTMiddlewareDiagnostics` class in the Web API)
```CSharp
// If you want to debug, or just understand the JwtBearer events, uncomment the following line of code
options.Events = JwtBearerMiddlewareDiagnostics.Subscribe(options.Events);
```