Exemplo n.º 1
0
        public async override Task <AuthenticationState> GetAuthenticationStateAsync()
        {
            var token = await _localStorage.GetItemAsync <string>(Constants.TOKEN_NAME);

            if (string.IsNullOrEmpty(token) || string.IsNullOrWhiteSpace(token))
            {
                return(_anonymous);
            }
            _httpClientProvider.AddHeader("bearer", token);
            NotifyUserAuthentication(token);
            return(new AuthenticationState(GetAuthenticatedUser(token)));
        }