Versions in this module Expand all Collapse all v0 v0.61.0 Dec 3, 2026 Changes in this version + const AuthURL + const CallbackAddr + const CallbackURI + const ClientID + const DefaultUpstream + const TokenURL + func BuildAuthURL(state string, pkce *PKCECodes) string + func Login(ctx context.Context, client OAuthClient, tokenPath string, out io.Writer) error + func NewTransport(next http.RoundTripper, upstream *url.URL, tokens TokenSource) http.RoundTripper + func WriteTokenFile(ctx context.Context, path string, ts *TokenStorage) error + type Credentials struct + AccessToken string + AccountID string + type IDTokenAuthNS struct + ChatgptAccountID string + ChatgptPlanType string + type IDTokenClaims struct + Auth IDTokenAuthNS + Email string + func ParseIDToken(ctx context.Context, token string) (*IDTokenClaims, error) + type OAuthClient interface + ExchangeCode func(ctx context.Context, code string, pkce *PKCECodes) (*TokenStorage, error) + Refresh func(ctx context.Context, refreshToken string) (*TokenStorage, error) + func NewOAuthClient(httpClient *http.Client, tokenURL string, now libtime.CurrentDateTimeGetter) OAuthClient + type PKCECodes struct + CodeChallenge string + CodeVerifier string + func GeneratePKCECodes(ctx context.Context) (*PKCECodes, error) + type TokenSource interface + Credentials func(ctx context.Context) (Credentials, error) + Invalidate func() + func NewFileTokenSource(path string, client OAuthClient, now libtime.CurrentDateTimeGetter) TokenSource + func SharedFileTokenSource(path string, client OAuthClient, now libtime.CurrentDateTimeGetter) TokenSource + type TokenStorage struct + AccessToken string + AccountID string + Email string + Expire string + IDToken string + LastRefresh string + PlanType string + RefreshToken string + Type string + func ReadTokenFile(ctx context.Context, path string) (*TokenStorage, error)