Is there a way to debug OWIN middleware from extensions like WindowsAzureActiveDirectoryBearerAuthenticationOptions and see exactly why the request was rejected (e.g. no token, wrong resource id, invalid signature, …) ?
One thing you can do is enable logging in OWIN:
<configuration>
<system.diagnostics>
<switches>
<add name="Microsoft.Owin" value="Verbose" />
</switches>
</system.diagnostics>
</configuration>
I sent an expired token to my API and got this in the Output:
Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationMiddleware Error: 0 : Authentication failed
System.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired.
More info about configuring OWIN logging: http://www.tugberkugurlu.com/archive/logging-in-the-owin-world-with-microsoft-owin--introduction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With