I am trying to upgrade from Blazor Server App from .Net 6 to 8.
This is the code in .Net 6:
_Host.cshtml
var context = HttpContext.Request.HttpContext;
var token = await AuthenticationHttpContextExtensions.GetTokenAsync(context, "id_token");
However in .Net 8, there is no more _Host.cshtml. So I had move the code above to App.razor in OnInitializedAsync() but the id_token is always null.
May I know what should I change?
Expected to get the id_token. That will be used to do a custom authentication and authorisation. So getting id_token is crucial.