public virtual OAuthRefreshTokenResponse RefreshAuthToken(string scope = null, string grantType = "refresh_token", string refreshToken = null) { OAuthRefreshTokenResponse resp = ExecuteRequest <OAuthRefreshTokenResponse>(HttpMethod.Post, "/oauth2/token", new Dictionary <string, string> { { "refresh_token", refreshToken ?? _refreshToken }, { "grant_type", grantType }, { "scope", scope }, }); _accessToken = resp.access_token; return(resp); }
/// <summary> /// A method that executes refresh token flow /// </summary> public OAuthRefreshTokenResponse ExecuteRefreshTokenFlow(OAuthTokenRequest tokenRequest) { if (!string.IsNullOrEmpty(tokenRequest.scope) && !tokenRequest.scope.Equals(DEFAULT_SCOPE)) { throw new ApiException(HttpStatusCode.BadRequest, "The specified scope is invalid"); } if (string.IsNullOrEmpty(tokenRequest.refresh_token)) { throw new ApiException(HttpStatusCode.BadRequest, "Missing required parameter: refresh_token"); } Guid accessToken = Guid.NewGuid(); long memberId = RefreshMemberAuthorization(tokenRequest.refresh_token, accessToken.ToString()); var oAuthTokenResponse = new OAuthRefreshTokenResponse { MemberID = memberId, access_token = accessToken.ToString(), token_type = TOKEN_TYPE_BEARER, scope = tokenRequest.scope }; return(oAuthTokenResponse); }