I use Blazor WASM application (.NET 8) with Keycloak OpenId. The problem is I have no idea how to access the token from code (I want to store it to use later for logout as token_id_hint).
There are no handlers I can add my method to AddOidcAuthentication configuration:
builder.Services.AddOidcAuthentication(options =>{ options.ProviderOptions.MetadataUrl = "https://my-domain.com/.well-known/openid-configuration"; options.ProviderOptions.Authority = "https://my-domain.com/realms/my-realm"; options.ProviderOptions.ClientId = "website-auth"; options.ProviderOptions.ResponseType = "id_token token"; options.UserOptions.NameClaim = "preferred_username"; options.UserOptions.RoleClaim = ClaimTypes.Role; options.UserOptions.ScopeClaim = "scope";}).AddAccountClaimsPrincipalFactory<CustomAccountClaimsPrincipalFactory>();Also I can't intercept it using IAccessTokenProviderAccessor, it always returns empty token:
var tokenResult = await AccessTokenProvier.RequestAccessToken();How do I get my token in .NET 8 + OIDC?