auth

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearTokens

func ClearTokens() error

ClearTokens removes the token file from disk.

func SaveTokens

func SaveTokens(tokens *TokenResponse) error

SaveTokens saves OAuth tokens to disk with restricted permissions.

func TokenFilePath

func TokenFilePath() (string, error)

TokenFilePath returns the path to the OAuth token file.

Types

type AuthClient

type AuthClient struct {
	// contains filtered or unexported fields
}

AuthClient handles unified browser-based authentication.

func NewAuthClient

func NewAuthClient(apiBaseURL string) *AuthClient

NewAuthClient creates a new authentication client.

func (*AuthClient) Login

func (c *AuthClient) Login(ctx context.Context) (*TokenResponse, error)

Login opens the browser to the API's login page and waits for the callback.

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token,omitempty"`
	IDToken     string `json:"id_token"`
	TokenType   string `json:"token_type"`
	ExpiryDate  int64  `json:"expiry_date"`
	Scope       string `json:"scope"`
}

TokenResponse represents the OAuth token response stored locally.

func LoadTokens

func LoadTokens() (*TokenResponse, error)

LoadTokens loads OAuth tokens from disk.

func (*TokenResponse) IsTokenExpired

func (t *TokenResponse) IsTokenExpired() bool

IsTokenExpired checks if the token has expired.

Jump to

Keyboard shortcuts

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