/// <summary> /// RequestRefreshTokenAsync call /// </summary> /// <param name="client">client</param> /// <param name="refreshToken">refreshToken</param> /// <param name="extra">extra</param> /// <param name="cancellationToken">cancellationToken</param> /// <returns>task of TokenResponse</returns> public static Task <TokenResponse> RequestRefreshTokenAsync(this TokenClient client, string refreshToken, object extra = null, CancellationToken cancellationToken = default(CancellationToken)) { var fields = new Dictionary <string, string> { { OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.RefreshToken }, { OidcConstants.TokenRequest.RefreshToken, refreshToken } }; return(client.RequestAsync(Merge(client, fields, extra), cancellationToken)); }
/// <summary> /// RequestTokenFromCodeAsync call /// </summary> /// <param name="client">client</param> /// <param name="code">code</param> /// <param name="redirectUri">redirectUri</param> /// <param name="codeVerifier">codeVerifier</param> /// <param name="extra">extra</param> /// <param name="cancellationToken">cancellationToken</param> /// <returns>task of TokenResponse</returns> public static Task <TokenResponse> RequestTokenFromCodeAsync(this TokenClient client, string code, string redirectUri, string codeVerifier = null, object extra = null, CancellationToken cancellationToken = default(CancellationToken)) { var fields = new Dictionary <string, string> { { OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.AuthorizationCode }, { OidcConstants.TokenRequest.Code, code }, { OidcConstants.TokenRequest.RedirectUri, redirectUri } }; return(client.RequestAsync(Merge(client, fields, extra), cancellationToken)); }
/// <summary> /// RequestRefreshTokenAsync call /// </summary> /// <param name="client">client</param>F /// <param name="refreshToken">refreshToken</param> /// <param name="extra">extra</param> /// <param name="cancellationToken">cancellationToken</param> /// <returns>task of TokenResponse</returns> public static Task <TokenResponse> RequestRefreshTokenAsync(this TokenClient client, string refreshToken, object extra = null, CancellationToken cancellationToken = default(CancellationToken)) { if (OAuth2Client.AdvancedLoggerEnabled != false) { OAuth2Client.AdvancedLogger.Log("Refresh token request initiated"); } var fields = new Dictionary <string, string> { { OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.RefreshToken }, { OidcConstants.TokenRequest.RefreshToken, refreshToken } }; return(client.RequestAsync(Merge(client, fields, extra), cancellationToken)); }
/// <summary> /// RequestTokenFromCodeAsync call /// </summary> /// <param name="client">client</param> /// <param name="code">code</param> /// <param name="redirectUri">redirectUri</param> /// <param name="codeVerifier">codeVerifier</param> /// <param name="extra">extra</param> /// <param name="cancellationToken">cancellationToken</param> /// <returns>task of TokenResponse</returns> public static Task <TokenResponse> RequestTokenFromCodeAsync(this TokenClient client, string code, string redirectUri, string codeVerifier = null, object extra = null, CancellationToken cancellationToken = default(CancellationToken)) { if (OAuth2Client.AdvancedLoggerEnabled != false) { OAuth2Client.AdvancedLogger.Log("Access/Bearer token request initiated"); } var fields = new Dictionary <string, string> { { OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.AuthorizationCode }, { OidcConstants.TokenRequest.Code, code }, { OidcConstants.TokenRequest.RedirectUri, redirectUri } }; return(client.RequestAsync(Merge(client, fields, extra), cancellationToken)); }