Blazor WASM passing to Web API

So following the example I created a Blazor WASM front end with a .Net Web Api back end. In addition I created a custom claim that adds the groups I have add the user to. This works fine on the front end but when passed backed to the .Net Core Web API side of things the custom claim for the groups is gone.

This is the code I used.

 builder.Services.AddHttpClient("KeeperLife.UI.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
                .AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();

            // Supply HttpClient instances that include access tokens when making requests to the server project
            builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient("KeeperLife.UI.ServerAPI"));

So I figured this out and it was kind of a silly miss on my part. When you first get your token from Okta for the Blazor front end it is returning an identity token. What is being sent on to the Web API is an access token. In my case I had my extra field associated only with the identity token and not on the access token. To correct I went in to the server and added the custom claim to the access token and it now sends through correctly.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.