コード例 #1
0
        public async Task <bool> GetRefreshedToken()
        {
            if (localStorage.HasRefreshToken())
            {
                var refreshToken = localStorage.GetRefreshToken();

                var requestHeaders = RequestHeadersUtility.GetRequestHeaders(localStorage);

                var response = await userServiceClient.GetRefreshedTokenAsync(new GetRefreshedTokenRequest { RefreshToken = refreshToken }, requestHeaders);

                if (!response.IsError)
                {
                    localStorage.SetAuthorizationTokens(response.TokenType, response.AccessToken, response.RefreshToken);
                }
                else
                {
                    localStorage.RemoveAuthorizationTokens();
                }

                return(!response.IsError);
            }

            return(false);
        }