Esempio n. 1
0
        public async Task AuthorizeRequestAsync(HttpWebRequest req)
        {
            if (this.getTokenResponse.IsExpired)
            {
                this.getTokenResponse = GetTokenResponse.CreateFromResponse(await RefreshAuthTokenAsync(this.getTokenResponse));
            }

            req.Headers[HttpRequestHeader.Authorization] = "Bearer " + this.getTokenResponse.AccessToken;
        }
Esempio n. 2
0
        public async Task <bool> InitializeAuthorizationAsync(string authorizationCode)
        {
            if (this.getTokenResponse != null)
            {
                return(true);
            }

            this.getTokenResponse = GetTokenResponse.CreateFromResponse(await GetNewAuthTokenAsync(authorizationCode));
            return(this.getTokenResponse != null);
        }