Interface IGoogleAuthenticator
- Namespace
- GenerativeAI.Core
- Assembly
- GenerativeAI.dll
Defines the contract for an authenticator to manage authentication processes for Google services.
public interface IGoogleAuthenticator
- Extension Methods
Methods
GetAccessTokenAsync(CancellationToken)
Asynchronously retrieves an access token needed for authentication.
Task<AuthTokens?> GetAccessTokenAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA cancellation token to cancel the operation.
Returns
- Task<AuthTokens>
A task representing the asynchronous operation, containing the authentication tokens.
RefreshAccessTokenAsync(AuthTokens, CancellationToken)
Asynchronously refreshes the access token using the provided token information.
Task<AuthTokens?> RefreshAccessTokenAsync(AuthTokens token, CancellationToken cancellationToken = default)
Parameters
tokenAuthTokensThe existing authentication token to be refreshed.
cancellationTokenCancellationTokenA cancellation token to cancel the operation.
Returns
- Task<AuthTokens>
A task representing the asynchronous operation, containing the refreshed authentication tokens.
ValidateAccessTokenAsync(string, bool, CancellationToken)
Asynchronously validates the provided access token.
Task<AuthTokens?> ValidateAccessTokenAsync(string accessToken, bool throwError = true, CancellationToken cancellationToken = default)
Parameters
accessTokenstringThe access token to be validated.
throwErrorboolIndicates whether an error should be thrown if validation fails.
cancellationTokenCancellationTokenA cancellation token to cancel the operation.
Returns
- Task<AuthTokens>
A task representing the asynchronous operation. Returns the authentication tokens if the access token is valid; otherwise, null if throwError is false.