oauth

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package oauth provides manual OAuth token refresh helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderResult

type ProviderResult struct {
	Provider  string
	AccountID string
	Success   bool
	Err       error
}

ProviderResult holds per-provider/account refresh outcome.

type RefreshOptions

type RefreshOptions struct {
	// Provider is the OAuth provider name (e.g. "google", "github").
	// Empty when --all is set.
	Provider string
	// AccountID scopes the refresh to a single account.
	// Empty means refresh all accounts for the provider.
	AccountID string
	// All refreshes all providers.
	All bool
	// BaseURL is the nSelf API base URL.
	BaseURL string
	// Stdout/Stderr for output.
	Stdout io.Writer
	Stderr io.Writer
	// HTTPClient allows injection in tests.
	HTTPClient *http.Client
}

RefreshOptions holds parsed flags for oauth refresh.

type RefreshResult

type RefreshResult struct {
	Results   []ProviderResult
	FailCount int
}

RefreshResult aggregates all per-provider results.

func Refresh

func Refresh(ctx context.Context, opts RefreshOptions) (*RefreshResult, error)

Refresh triggers immediate OAuth token refresh outside the cron schedule.

--all refreshes every account on every provider in parallel. Success/failure is visible in the OAuth refresh Prometheus metrics within 5s (requires S41-T03 exporter). OAuth tokens are never exposed in output (only prefix match in logs). Exit non-zero if any account fails.

Jump to

Keyboard shortcuts

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