auth

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthenticatedClient

func GetAuthenticatedClient(ctx context.Context, ts *TokenStorage, cfg *config.Config) (*http.Client, error)

GetAuthenticatedClient configures and returns an HTTP client ready for making authenticated API calls. It manages the entire OAuth2 flow, including handling proxies, loading existing tokens, initiating a new web-based OAuth flow if necessary, and refreshing tokens.

Types

type TokenStorage

type TokenStorage struct {
	// Token holds the raw OAuth2 token data, including access and refresh tokens.
	Token any `json:"token"`
	// ProjectID is the Google Cloud Project ID associated with this token.
	ProjectID string `json:"project_id"`
	// Email is the email address of the authenticated user.
	Email string `json:"email"`
	// Auto indicates if the project ID was automatically selected.
	Auto bool `json:"auto"`
	// Checked indicates if the associated Cloud AI API has been verified as enabled.
	Checked bool `json:"checked"`
}

TokenStorage defines the structure for storing OAuth2 token information, along with associated user and project details. This data is typically serialized to a JSON file for persistence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL