Documentation
¶
Overview ¶
Package auth provides authentication for Google Cloud APIs.
It supports multiple authentication methods: - Application Default Credentials (for local development via gcloud). - GCP Metadata Server (for GCE, GKE, Cloud Run, Cloud Functions, App Engine).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessToken ¶
AccessToken retrieves a GCP access token. It tries Application Default Credentials first, then falls back to the metadata server. Configuration can be provided via auth.WithConfig in the context.
Types ¶
type Config ¶ added in v0.6.0
type Config struct {
// MetadataURL is the URL for the GCP metadata server.
// Defaults to the production metadata server if empty.
MetadataURL string
// SkipADC skips Application Default Credentials and goes straight to metadata server.
// Useful for testing to ensure mock servers are used.
SkipADC bool
}
Config holds auth configuration.
Click to show internal directories.
Click to hide internal directories.