Versions in this module Expand all Collapse all v6 v6.9.3 Mar 25, 2026 Changes in this version + const AuthURL + const ClientID + const LoginSuccessHtml + const RedirectURI + const SetupNoticeHtml + const TokenURL + var ErrBrowserOpenFailed = &AuthenticationError + var ErrCallbackTimeout = &AuthenticationError + var ErrCodeExchangeFailed = &AuthenticationError + var ErrInvalidState = &AuthenticationError + var ErrPortInUse = &AuthenticationError + var ErrServerStartFailed = &AuthenticationError + func CredentialFileName(email, planType, hashAccountID string, includeProviderPrefix bool) string + func GetUserFriendlyMessage(err error) string + func IsAuthenticationError(err error) bool + func IsOAuthError(err error) bool + type AuthenticationError struct + Cause error + Code int + Message string + Type string + func NewAuthenticationError(baseErr *AuthenticationError, cause error) *AuthenticationError + func (e *AuthenticationError) Error() string + type CodexAuth struct + func NewCodexAuth(cfg *config.Config) *CodexAuth + func (o *CodexAuth) CreateTokenStorage(bundle *CodexAuthBundle) *CodexTokenStorage + func (o *CodexAuth) ExchangeCodeForTokens(ctx context.Context, code string, pkceCodes *PKCECodes) (*CodexAuthBundle, error) + func (o *CodexAuth) ExchangeCodeForTokensWithRedirect(ctx context.Context, code, redirectURI string, pkceCodes *PKCECodes) (*CodexAuthBundle, error) + func (o *CodexAuth) GenerateAuthURL(state string, pkceCodes *PKCECodes) (string, error) + func (o *CodexAuth) RefreshTokens(ctx context.Context, refreshToken string) (*CodexTokenData, error) + func (o *CodexAuth) RefreshTokensWithRetry(ctx context.Context, refreshToken string, maxRetries int) (*CodexTokenData, error) + func (o *CodexAuth) UpdateTokenStorage(storage *CodexTokenStorage, tokenData *CodexTokenData) + type CodexAuthBundle struct + APIKey string + LastRefresh string + TokenData CodexTokenData + type CodexAuthInfo struct + ChatgptAccountID string + ChatgptPlanType string + ChatgptSubscriptionActiveStart any + ChatgptSubscriptionActiveUntil any + ChatgptSubscriptionLastChecked time.Time + ChatgptUserID string + Groups []any + Organizations []Organizations + UserID string + type CodexTokenData struct + AccessToken string + AccountID string + Email string + Expire string + IDToken string + RefreshToken string + type CodexTokenStorage struct + AccessToken string + AccountID string + Email string + Expire string + IDToken string + LastRefresh string + Metadata map[string]any + RefreshToken string + Type string + func (ts *CodexTokenStorage) SaveTokenToFile(authFilePath string) error + func (ts *CodexTokenStorage) SetMetadata(meta map[string]any) + type JWTClaims struct + AtHash string + Aud []string + AuthProvider string + AuthTime int + CodexAuthInfo CodexAuthInfo + Email string + EmailVerified bool + Exp int + Iat int + Iss string + Jti string + Rat int + Sid string + Sub string + func ParseJWTToken(token string) (*JWTClaims, error) + func (c *JWTClaims) GetAccountID() string + func (c *JWTClaims) GetUserEmail() string + type OAuthError struct + Code string + Description string + StatusCode int + URI string + func NewOAuthError(code, description string, statusCode int) *OAuthError + func (e *OAuthError) Error() string + type OAuthResult struct + Code string + Error string + State string + type OAuthServer struct + func NewOAuthServer(port int) *OAuthServer + func (s *OAuthServer) IsRunning() bool + func (s *OAuthServer) Start() error + func (s *OAuthServer) Stop(ctx context.Context) error + func (s *OAuthServer) WaitForCallback(timeout time.Duration) (*OAuthResult, error) + type Organizations struct + ID string + IsDefault bool + Role string + Title string + type PKCECodes struct + CodeChallenge string + CodeVerifier string + func GeneratePKCECodes() (*PKCECodes, error) v6.9.2-rc1 Mar 25, 2026