Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveTokens ¶
func SaveTokens(tokens *TokenResponse) error
SaveTokens saves OAuth tokens to disk with restricted permissions.
func TokenFilePath ¶
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.
Click to show internal directories.
Click to hide internal directories.