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

Hi @steamonimo,
We’ve just updated the blog post with the logout fixes.

Regarding your request about user data, unfortunately, User.Identity is not automatically populated with the user profile’s data. To enable it, you should apply some changes to OpenID Connect settings in the Startup.cs file.
You have to add using Microsoft.IdentityModel.Tokens; in the using section. Then, you need to adjust the OpenID connect options as follows:

  .AddOpenIdConnect("Auth0", options =>
  {
    //... other options

    // Configure the scope
    options.Scope.Clear();
    options.Scope.Add("openid");
    // new stuff
    options.Scope.Add("profile");

    options.TokenValidationParameters = new TokenValidationParameters
      {
          NameClaimType = "name"
      };
    // end new stuff

    //... other options
  };

The newly added options are the profile scope, which requests the server for the user’s profile’s data, and the TokenValidationParameters, which indicates how to map the OpenID claims to User.Identity properties.
There are historical reasons behind this. If you want to know more, read this.

1 Like