genkit_vertex_auth library

Constants

cloudPlatformScope → const String
OAuth scope used by most Vertex AI OpenAPI calls.

Functions

createAdcAccessTokenProvider({List<String> scopes = const [cloudPlatformScope], Client? baseClient}) AccessTokenProvider
Creates an access token provider backed by Application Default Credentials.
createServiceAccountAccessTokenProvider({required Object credentialsJson, List<String> scopes = const [cloudPlatformScope], String? impersonatedUser, Client? baseClient}) AccessTokenProvider
Creates an access token provider backed by service account credentials.
extractProjectIdFromServiceAccountJson(Object credentialsJson) String?
Extracts project_id from service account credentials JSON.
googleApiClientHeaderValue() String
Returns the standard Google API client header value used by Genkit.
normalizeVertexLocation(String location) String
Returns a normalized Vertex location string for URL construction.
resolveEnvironmentProjectId() String?
Resolves a project ID from common Google Cloud environment variables.
resolveVertexAccessToken({required String providerName, required String? accessToken, required AccessTokenProvider? accessTokenProvider}) Future<String>
Resolves and validates a non-empty OAuth access token.
resolveVertexProjectId({required String providerName, required String configTypeName, required String? projectId, required String? projectIdFromCredentials}) String
Resolves a project ID from explicit, credentials, or environment sources.
validateVertexConfigBasics({required String providerName, required String? projectId, required String location, required String? accessToken, required AccessTokenProvider? accessTokenProvider}) → void
Validates common Vertex config fields used by provider-specific configs.
validateVertexEndpointId({required String providerName, required String endpointId}) → void
Validates endpoint IDs used by Vertex API endpoint-style paths.
vertexApiHostForLocation(String location) String
Returns the Vertex API host for a normalized/non-normalized location.

Typedefs

AccessTokenProvider = FutureOr<String> Function()
Signature used to provide an OAuth2 access token for Vertex AI requests.