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; }
public async Task <bool> InitializeAuthorizationAsync(string authorizationCode) { if (this.getTokenResponse != null) { return(true); } this.getTokenResponse = GetTokenResponse.CreateFromResponse(await GetNewAuthTokenAsync(authorizationCode)); return(this.getTokenResponse != null); }