SecurityService User.Id Value keep changing on Each Load

I'm currently using Radzen Libary for creating a Blazor Web Application (Client + Server) .User authentication is managed using ASP.Net Core Identity with an MS SQL Server Database.
The issue I face is the value of User.Id within the SecurityService keeps changing on each refresh/ load. So I'm unable to track the state of the user progress.

Is this supposed to behave this way ?

The SecurityService doesn't set Id by default. Feel free to extend the Initialize method as needed:

        public bool Initialize(AuthenticationState result)
        {
            Principal = result.User;

            var name = Principal.FindFirstValue(ClaimTypes.Name) ?? Principal.FindFirstValue("name");

            if (name != null)
            {
                User = new ApplicationUser { Name = name };
            }

            return IsAuthenticated();
        }

Thanks , but Similar code was already present by default.. I updated the code but it still produces new Id for each load.


This is the code which was present by default.. i replaced this with the one you provided. But still the same issue.

I suggest debugging the InitializeAsync method.

I think what i intended was actually present and it was due to the #DEBUG flag

But this changes never fixed the actual issue. The user id keeps on changing for each login.