Add Auth0 Authentication to Blazor Web Apps

Hi @chadwick.posey,
Welcome to the Auth0 Community! :wave: Thank you for appreciating this article :slightly_smiling_face:

You are right: the Auth0 ASP.NET Core Authentication SDK uses the Implicit Flow with Form Post by default. This is ok as long as you just need an ID token (i.e., just user authentication).

If you need an access token, i.e., you need to call an external API, you have to switch to the Authorization Code Flow. You can do this very easily using the SDK, as shown in the following code:

builder.Services
    .AddAuth0WebAppAuthentication(options => {
      options.Domain = builder.Configuration["Auth0:Domain"];
      options.ClientId = builder.Configuration["Auth0:ClientId"];
    })
    .WithAccessToken(options =>
    {
        options.Audience = Configuration["Auth0:Audience"];
    });

Of course, you need to specify the API audience.

Please, take a look at this doc for some code examples using the Auth0 ASP.NET Core Authentication SDK.

Related to the redirect_uri issue, I’m not sure I correctly understand :thinking:
Are you saying that passing the URI to the WithRedirectUri() does not work as expected? If so, can you provide some code to analyze?