Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

UserId from AuthenticationStateProvider keeps on changing on each refresh

$
0
0

I'm currently creating a Blazor web application (client + server). User authentication is managed using ASP.NET Core Identity with a SQL Server database.

The issue I face is the value of _userId keeps on changing with each refresh, so I'm unable to track the state of the user using the same.

protected override async Task OnInitializedAsync(){    var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();    user = authState.User;    var _userId = user.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>