/// <summary>Gets the current authorization token. /// In the very first call, this method creates a new token before returning. /// If currently stored token is expired, this method creates a new one. /// </summary> /// <returns>Valid OAuthToken instance.</returns> public OAuthTokenDTO GetToken() { OAuthTokenDTO token = _storageStrategy.Get(); if (token == null || token.IsExpired()) { StoreToken(this._root.AuthenticationManager.CreateToken()); } return(_storageStrategy.Get()); }
/// <summary>Gets the current authorization token. /// In the very first call, this method creates a new token before returning. /// If currently stored token is expired, this method creates a new one. /// </summary> /// <returns>Valid OAuthToken instance.</returns> public async Task <OAuthTokenDTO> GetToken() { OAuthTokenDTO token = _storageStrategy.Get(GetEnvKey()); if (token == null || token.IsExpired()) { StoreToken(await this._root.AuthenticationManager.CreateToken()); } return(_storageStrategy.Get(GetEnvKey())); }
/// <summary>Gets the current authorization token. /// In the very first call, this method creates a new token before returning. /// If currently stored token is expired, this method creates a new one. /// </summary> /// <returns>Valid OAuthToken instance.</returns> public OAuthTokenDTO GetToken() { OAuthTokenDTO token = _storageStrategy.Get(GetEnvKey()); if (token == null || token.IsExpired()) { var result = this._root.AuthenticationManager.CreateToken(); StoreToken(result); } return(_storageStrategy.Get(GetEnvKey())); }