public void NotifyUserAuthentication(string token)
        {
            var authenticatedUser = new ClaimsPrincipal(
                new ClaimsIdentity(JwtParser.ParseClaimFromJwt(token),
                                   "jwtAuthType"));
            var authState = Task.FromResult(new AuthenticationState(authenticatedUser));

            NotifyAuthenticationStateChanged(authState);
        }
        public override async Task <AuthenticationState> GetAuthenticationStateAsync()
        {
            var token = await localStorage.GetItemAsync <string>("authToken");

            if (string.IsNullOrWhiteSpace(token))
            {
                return(_anonymous);
            }

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token);

            return(new AuthenticationState(
                       new ClaimsPrincipal(
                           new ClaimsIdentity(JwtParser.ParseClaimFromJwt(token),
                                              "jwtAuthType"))
                       ));
        }