1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public class GoogleAuthorizationCodeFlow : AuthorizationCodeFlow, IAuthorizationCodeFlow, IDisposable

Google specific authorization code flow which inherits from [AuthorizationCodeFlow](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt).

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [AuthorizationCodeFlow](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt) \> GoogleAuthorizationCodeFlow

## Implements

[IAuthorizationCodeFlow](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.md.txt), [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Inherited Members

[AuthorizationCodeFlow.TokenServerUrl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_TokenServerUrl) [AuthorizationCodeFlow.AuthorizationServerUrl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_AuthorizationServerUrl) [AuthorizationCodeFlow.ClientSecrets](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_ClientSecrets) [AuthorizationCodeFlow.DataStore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_DataStore) [AuthorizationCodeFlow.Scopes](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_Scopes) [AuthorizationCodeFlow.HttpClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_HttpClient) [AuthorizationCodeFlow.AccessMethod](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_AccessMethod) [AuthorizationCodeFlow.Clock](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_Clock) [AuthorizationCodeFlow.LoadTokenAsync(string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_LoadTokenAsync_System_String_System_Threading_CancellationToken_) [AuthorizationCodeFlow.DeleteTokenAsync(string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_DeleteTokenAsync_System_String_System_Threading_CancellationToken_) [AuthorizationCodeFlow.ExchangeCodeForTokenAsync(string, string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_ExchangeCodeForTokenAsync_System_String_System_String_System_String_System_Threading_CancellationToken_) [AuthorizationCodeFlow.CreateAuthorizationCodeTokenRequest(string, string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_CreateAuthorizationCodeTokenRequest_System_String_System_String_System_String_) [AuthorizationCodeFlow.ExchangeCodeForTokenAsync(string, AuthorizationCodeTokenRequest, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_ExchangeCodeForTokenAsync_System_String_Google_Apis_Auth_OAuth2_Requests_AuthorizationCodeTokenRequest_System_Threading_CancellationToken_) [AuthorizationCodeFlow.RefreshTokenAsync(string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_RefreshTokenAsync_System_String_System_String_System_Threading_CancellationToken_) [AuthorizationCodeFlow.FetchTokenAsync(string, TokenRequest, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_FetchTokenAsync_System_String_Google_Apis_Auth_OAuth2_Requests_TokenRequest_System_Threading_CancellationToken_) [AuthorizationCodeFlow.Dispose()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_Dispose) [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[PkceGoogleAuthorizationCodeFlow](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.PkceGoogleAuthorizationCodeFlow.md.txt)

## Namespace

[Google.Apis.Auth.OAuth2.Flows](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.md.txt)

## Assembly

Google.Apis.Auth.dll

## Constructors

### GoogleAuthorizationCodeFlow(Initializer)

    public GoogleAuthorizationCodeFlow(GoogleAuthorizationCodeFlow.Initializer initializer)

Constructs a new Google authorization code flow.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `initializer` | `GoogleAuthorizationCodeFlowInitializer` |

## Fields

### includeGrantedScopes

    [Obsolete("Use IncludeGrantedScopes instead.")]
    public readonly bool? includeGrantedScopes

Gets the include granted scopes indicator.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

## Properties

### IncludeGrantedScopes

    public bool? IncludeGrantedScopes { get; }

Gets the include granted scopes indicator.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### LoginHint

    public string LoginHint { get; }

Gets the login_hint.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### Nonce

    public string Nonce { get; }

Gets the nonce.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### ProjectId

    public string ProjectId { get; }

The project ID associated with the credential using this flow.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### Prompt

    public string Prompt { get; }

Gets the prompt for consent behaviour.
Value can be `null`, `"none"`, `"consent"`, or `"select_account"`.
See [OpenIDConnect documentation](https://developers.google.com/identity/protocols/OpenIDConnect#prompt)
for details.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### RevokeTokenUrl

    public string RevokeTokenUrl { get; }

Gets the token revocation URL.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### UserDefinedQueryParams

    public IEnumerable<KeyValuePair<string, string>> UserDefinedQueryParams { get; }

Gets the user defined query parameters.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| ``IEnumerableSystem.Collections.Generic.KeyValuePair`2stringstring`` |   |

## Methods

### CreateAuthorizationCodeRequest(string)

    public override AuthorizationCodeRequestUrl CreateAuthorizationCodeRequest(string redirectUri)

Creates an authorization code request with the specified redirect URI.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `redirectUri` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AuthorizationCodeRequestUrl` |   |

**Overrides** [AuthorizationCodeFlow.CreateAuthorizationCodeRequest(string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_CreateAuthorizationCodeRequest_System_String_)

### RevokeTokenAsync(string, string, CancellationToken)

    public override Task RevokeTokenAsync(string userId, string token, CancellationToken taskCancellationToken)

Asynchronously revokes the specified token. This method disconnects the user's account from the OAuth 2.0
application. It should be called upon removing the user account from the site.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `userId` | `string` User identifier. |
| `token` | `string` Access token to be revoked. |
| `taskCancellationToken` | `CancellationToken` Cancellation token to cancel operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Task` | `true` if the token was revoked successfully. |

**Overrides** [AuthorizationCodeFlow.RevokeTokenAsync(string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_RevokeTokenAsync_System_String_System_String_System_Threading_CancellationToken_) **Remarks** If revoking the token succeeds, the user's credential is removed from the data store and the user MUST
authorize the application again before the application can access the user's private resources.

### ShouldForceTokenRetrieval()

    public override bool ShouldForceTokenRetrieval()

Indicates if a new token needs to be retrieved and stored regardless of normal circumstances.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

**Overrides** [AuthorizationCodeFlow.ShouldForceTokenRetrieval()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.md.txt#Google_Apis_Auth_OAuth2_Flows_AuthorizationCodeFlow_ShouldForceTokenRetrieval)

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities.md.txt#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)