Interface IPkceAuthorizationCodeFlow (1.68.0)

public interface IPkceAuthorizationCodeFlow : IAuthorizationCodeFlow, IDisposable

Authorization flow that supports Proof Key for Code Exchange (PKCE) as described in https://www.rfc-editor.org/rfc/rfc7636.

Namespace

Google.Apis.Auth.OAuth2.Flows

Assembly

Google.Apis.Auth.dll

Remarks

If you are writing your own authorization flow to be used with AuthorizationCodeInstalledApp make sure you implement this interface if you need to support PKCE. See https://developers.google.com/identity/protocols/oauth2/native-app for how Google supports PKCE.

Methods

CreateAuthorizationCodeRequest(string, out string)

AuthorizationCodeRequestUrl CreateAuthorizationCodeRequest(string redirectUri, out string codeVerifier)

Creates an authorization code request with the specified redirect URI.

Parameters
Name Description
redirectUri string

The redirect URI for the authorization code request.

codeVerifier string

The code verifier associated to the code challenge that should be included in the returned AuthorizationCodeRequestUrl. Note this is an

out
parameter.

Returns
Type Description
AuthorizationCodeRequestUrl

An AuthorizationCodeRequestUrl subclass instance that includes the code challenge and code challenge method associated with codeVerifier.

ExchangeCodeForTokenAsync(string, string, string, string, CancellationToken)

Task<TokenResponse> ExchangeCodeForTokenAsync(string userId, string code, string codeVerifier, string redirectUri, CancellationToken taskCancellationToken)

Asynchronously exchanges an authorization code for an access token.

Parameters
Name Description
userId string

User identifier.

code string

Authorization code received from the authorization server.

codeVerifier string

The PKCE code verifier to include in the exchange request. When called by the authentication library, this will be the same value specified by the

codeVerifier
out parameter in an earlier call to CreateAuthorizationCodeRequest.
redirectUri string

Redirect URI which is used in the token request.

taskCancellationToken CancellationToken

Cancellation token to cancel operation.

Returns
Type Description
TaskTokenResponse

Token response which contains the access token.

Extension Method