Table of Contents

Class GoogleOAuthAuthenticator

Namespace
GenerativeAI.Authenticators
Assembly
GenerativeAI.Authenticators.dll

Authenticator that uses Google OAuth2 for authentication with Google services.

public class GoogleOAuthAuthenticator : BaseAuthenticator, IGoogleAuthenticator
Inheritance
GoogleOAuthAuthenticator
Implements
Inherited Members
Extension Methods

Constructors

GoogleOAuthAuthenticator(string?)

Initializes a new instance of the GoogleOAuthAuthenticator class with the specified credential file.

public GoogleOAuthAuthenticator(string? credentialFile)

Parameters

credentialFile string

Path to the client secret JSON file. If null, uses default "client_secret.json".

Methods

GetAccessTokenAsync(CancellationToken)

Gets an access token asynchronously using the configured OAuth2 credentials.

public override Task<AuthTokens?> GetAccessTokenAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<AuthTokens>

A task representing the asynchronous operation that returns access token information.

RefreshAccessTokenAsync(AuthTokens, CancellationToken)

Refreshes an access token asynchronously using the provided token information.

public override Task<AuthTokens?> RefreshAccessTokenAsync(AuthTokens token, CancellationToken cancellationToken = default)

Parameters

token AuthTokens

The token information to refresh.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<AuthTokens>

A task representing the asynchronous operation that returns refreshed token information.