ReqLLM.Providers.GoogleVertex.Auth (ReqLLM v1.17.0)

View Source

Google Cloud OAuth2 authentication for Vertex AI.

Supports Application Default Credentials (ADC) and explicit service account credentials.

Summary

Functions

Get an OAuth2 access token and expiry metadata.

Get an OAuth2 access token from service account credentials.

Functions

fetch_access_token(source, opts \\ [])

Get an OAuth2 access token and expiry metadata.

Accepts :adc, {:service_account, credentials}, or the legacy direct service account credential formats accepted by get_access_token/1.

get_access_token(service_account)

Get an OAuth2 access token from service account credentials.

Accepts credentials in multiple formats:

  • File path (string) - if file exists, reads and parses JSON file
  • JSON string (string) - if not a file, parses as JSON directly
  • Map - uses as-is (already parsed, normalizes atom keys to strings)

Generates a fresh token on each call. Tokens are valid for 1 hour.

Returns {:ok, access_token} or {:error, reason}.