auth

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigDirName is the name of the configuration directory
	// Deprecated: Use config.DirName instead
	ConfigDirName = config.DirName
	// CredentialsFile is the name of the OAuth credentials file
	// Deprecated: Use config.CredentialsFile instead
	CredentialsFile = config.CredentialsFile
	// TokenFile is the name of the OAuth token file (fallback storage)
	// Deprecated: Use config.TokenFile instead
	TokenFile = config.TokenFile
)

Re-export constants for backward compatibility

Variables

AllScopes contains all OAuth scopes used by the application

Functions

func ExchangeAuthCode

func ExchangeAuthCode(ctx context.Context, config *oauth2.Config, code string) (*oauth2.Token, error)

ExchangeAuthCode exchanges an authorization code for a token

func GetAuthURL

func GetAuthURL(config *oauth2.Config) string

GetAuthURL returns the OAuth authorization URL for the given config

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the configuration directory path, creating it if needed. Deprecated: Use config.GetConfigDir() instead

func GetCredentialsPath

func GetCredentialsPath() (string, error)

GetCredentialsPath returns the full path to credentials.json Deprecated: Use config.GetCredentialsPath() instead

func GetHTTPClient

func GetHTTPClient(ctx context.Context) (*http.Client, error)

GetHTTPClient returns an HTTP client with OAuth2 authentication. It retrieves tokens from keychain (preferred) or falls back to file storage. Returns an error if no token is found - caller should direct user to run 'gro init'.

func GetOAuthConfig

func GetOAuthConfig() (*oauth2.Config, error)

GetOAuthConfig loads OAuth configuration from credentials file with all scopes

func GetTokenPath

func GetTokenPath() (string, error)

GetTokenPath returns the full path to token.json (fallback storage) Deprecated: Use config.GetTokenPath() instead

func ShortenPath

func ShortenPath(path string) string

ShortenPath replaces the home directory prefix with ~ for display purposes. Deprecated: Use config.ShortenPath() instead

Types

This section is empty.

Jump to

Keyboard shortcuts

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