What is Blazor? A Tutorial on Building Web Apps with Authentication

Thanks for this post! It’s a good, simple implementation to get started with.

I’m seeing some difficulty with the /callback redirect in the actual Blazor application. The error I’m seeing OpenIdConnectProtocolException: Message contains error: 'invalid_grant', error_description: 'Invalid authorization code', error_uri: 'error_uri is null'. at the /callback URL.

If I check the logs, I can see there are three events happening at the Auth0 end:

  • Successful login
  • Authorization Code for Access Token
  • Invalid authorization code

Each straight after the other. I can see those authorization codes do match between the “Success Exchange” and the “Failed Exchange” entries.

I can see Auth0 authentication has actually taken place, and if I browse to other pages in my app, I can see I have logged in successfully, but that initial callback to the /callback URL stops things in their tracks. Is there something missing in the middleware / Startup.cs code, or are there additional things to check for the Auth0 application settings?