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
credentialFilestringPath 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
cancellationTokenCancellationTokenToken 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
tokenAuthTokensThe token information to refresh.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<AuthTokens>
A task representing the asynchronous operation that returns refreshed token information.