Versions in this module Expand all Collapse all v1 v1.0.2 Jun 3, 2026 v1.0.1 Jun 3, 2026 Changes in this version + var ErrNotAuthenticated = domain.ErrNotAuthenticated + func BuildAuthorizeURL(authorizeURL string, cfg OAuthConfig, state string) string + type Browser interface + OpenURL func(string) error + type Exchanger struct + HTTPClient *http.Client + Now func() time.Time + TokenURL string + func (e Exchanger) ExchangeCode(ctx context.Context, cfg OAuthConfig, code string) (Token, error) + func (e Exchanger) RefreshToken(ctx context.Context, cfg OAuthConfig, refreshToken string) (Token, error) + type FileStore struct + Path string + func (s FileStore) DeleteClientSecret() error + func (s FileStore) DeleteToken() error + func (s FileStore) LoadClientSecret() (string, error) + func (s FileStore) LoadToken() (Token, error) + func (s FileStore) SaveClientSecret(secret string) error + func (s FileStore) SaveToken(token Token) error + type LoginInput struct + ClientID string + ClientSecret string + RedirectURL string + type OAuthConfig struct + ClientID string + ClientSecret string + RedirectURL string + type Service struct + AuthorizeURL string + Browser Browser + ClientID string + Exchanger Exchanger + In io.Reader + Listen func(network, address string) (net.Listener, error) + Now func() time.Time + Out io.Writer + RefreshSkew time.Duration + StateSource func() string + Store TokenStore + func (s Service) AccessToken(ctx context.Context) (string, error) + func (s Service) Login(ctx context.Context, in LoginInput) (Token, error) + func (s Service) Logout(ctx context.Context) error + func (s Service) Status(ctx context.Context) (Status, error) + type Status struct + Authenticated bool + Expired bool + ExpiresAtUnix int64 + ExpiresInSeconds int64 + ExpiryKnown bool + HasRefresh bool + type Token struct + AccessToken string + CreatedAtUnix int64 + ExpiresAtUnix int64 + ExpiresIn int64 + RefreshToken string + Scope string + TokenType string + func (t Token) ExpiresAt() time.Time + func (t Token) HasExpiry() bool + func (t Token) NeedsRefresh(now time.Time, skew time.Duration) bool + type TokenStore interface + DeleteClientSecret func() error + DeleteToken func() error + LoadClientSecret func() (string, error) + LoadToken func() (Token, error) + SaveClientSecret func(string) error + SaveToken func(Token) error