Versions in this module Expand all Collapse all v0 v0.2.0 Jul 14, 2026 v0.1.0 Jun 22, 2026 Changes in this version + func GenerateState() string + type Client struct + func NewClient(config *Config) *Client + func (c *Client) AuthorizeURL(state string) string + func (c *Client) DeviceCode(ctx context.Context) (*DeviceCodeResponse, error) + func (c *Client) ExchangeCode(ctx context.Context, code, codeVerifier string) (*TokenResponse, error) + func (c *Client) ExchangeDeviceToken(ctx context.Context, deviceCode string, userCode string) (*TokenResponse, error) + func (c *Client) PollToken(ctx context.Context, deviceCode, userCode string, interval int) (*TokenResponse, error) + func (c *Client) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error) + type Config struct + AuthURL string + BaseURL string + ClientID string + ClientSecret string + DeviceAuthURL string + DeviceTokenURL string + HTTPClient *http.Client + RedirectURI string + Scopes []string + TokenURL string + func DefaultOpenAIConfig() *Config + type DeviceCodeResponse struct + DeviceCode string + ExpiresIn int + Interval int + UserCode string + VerificationURI string + VerificationURIComplete string + type Handler struct + func NewHandler(client *Client) *Handler + func (h *Handler) Start() (userCode, verificationURL string, err error) + func (h *Handler) Stop() + func (h *Handler) WaitComplete() (*Token, error) + type OAuthManager struct + func NewOAuthManager(s store.Store, provider string, cfg *Config) *OAuthManager + func (m *OAuthManager) Complete(ctx context.Context, token *Token) error + func (m *OAuthManager) GetToken(ctx context.Context) (string, error) + func (m *OAuthManager) LoadCredentials(ctx context.Context) (*authTypes.Credentials, error) + func (m *OAuthManager) Login(ctx context.Context) (userCode, url string, err error) + func (m *OAuthManager) Stop() + func (m *OAuthManager) StoreCredentials(ctx context.Context, creds *authTypes.Credentials) error + type ProviderConfig struct + AuthURL string + BaseURL string + ClientID string + DeviceCodeURL string + Scopes []string + TokenURL string + func DefaultGoogleProvider() *ProviderConfig + func DefaultOpenAIProvider() *ProviderConfig + type Server struct + func NewServer(config *ServerConfig) *Server + func (s *Server) Start(ctx context.Context) (string, error) + func (s *Server) Stop(ctx context.Context) error + func (s *Server) WaitForCallback(ctx context.Context) (*TokenResponse, error) + type ServerConfig struct + HTTPClient *http.Client + Port int + Timeout time.Duration + func DefaultServerConfig() *ServerConfig + type SimpleAuthenticator struct + func NewSimpleAuthenticator(clientID string) *SimpleAuthenticator + func (a *SimpleAuthenticator) StartDeviceFlow(ctx context.Context) (userCode, verificationURL string, err error) + func (a *SimpleAuthenticator) WaitDeviceFlow(ctx context.Context) (*Token, error) + type Token struct + AccessToken string + ExpiresAt time.Time + IDToken string + RefreshToken string + Scope string + TokenType TokenType + func (t *Token) IsExpired() bool + func (t *Token) NeedsRefresh() bool + type TokenResponse struct + AccessToken string + ExpiresIn int + IDToken string + RefreshToken string + Scope string + TokenType string + func (r *TokenResponse) ToToken() *Token + type TokenType string + const TokenTypeAccess + const TokenTypeRefresh