askauth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenAICodexClientID                  = "app_EMoamEEZ73f0CkXaXp7hrann"
	OpenAICodexDefaultAuthURL            = "https://auth.openai.com/oauth/authorize"
	OpenAICodexDefaultExchangeURL        = "https://auth.openai.com/oauth/token"
	OpenAICodexDefaultDeviceUserCodeURL  = "https://auth.openai.com/api/accounts/deviceauth/usercode"
	OpenAICodexDefaultDeviceExchangeURL  = "https://auth.openai.com/api/accounts/deviceauth/token"
	OpenAICodexDefaultDeviceVerification = "https://auth.openai.com/codex/device"
	OpenAICodexDefaultDeviceCallback     = "https://auth.openai.com/deviceauth/callback"
	OpenAICodexDefaultCallbackPort       = 1455
)

Variables

This section is empty.

Functions

func CredentialsPath

func CredentialsPath() (string, error)

func Delete

func Delete(provider string) error

func Save

func Save(session Session) error

Types

type OpenAICodexEndpoints

type OpenAICodexEndpoints struct {
	AuthURL           string
	TokenURL          string
	DeviceUserCodeURL string
	DeviceTokenURL    string
	DeviceVerifyURL   string
	DeviceCallbackURI string
}

func DefaultOpenAICodexEndpoints

func DefaultOpenAICodexEndpoints() OpenAICodexEndpoints

type OpenAICodexOptions

type OpenAICodexOptions struct {
	HTTPClient   *http.Client
	CallbackPort int
	OpenBrowser  bool
	Writer       io.Writer
	Now          func() time.Time
	Endpoints    OpenAICodexEndpoints
}

type Session

type Session struct {
	Provider     string    `json:"provider,omitempty"`
	AccessToken  string    `json:"accessToken,omitempty"`
	RefreshToken string    `json:"refreshToken,omitempty"`
	ExpiresAt    time.Time `json:"expiresAt,omitempty"`
	AccountEmail string    `json:"accountEmail,omitempty"`
	AccountID    string    `json:"accountId,omitempty"`
	IDToken      string    `json:"idToken,omitempty"`
	CreatedAt    time.Time `json:"createdAt,omitempty"`
	UpdatedAt    time.Time `json:"updatedAt,omitempty"`
}

func Load

func Load(provider string) (Session, bool, error)

func LoginOpenAICodexBrowser

func LoginOpenAICodexBrowser(ctx context.Context, opts OpenAICodexOptions) (Session, error)

func LoginOpenAICodexDevice

func LoginOpenAICodexDevice(ctx context.Context, opts OpenAICodexOptions) (Session, error)

func RefreshOpenAICodex

func RefreshOpenAICodex(ctx context.Context, opts OpenAICodexOptions, refreshToken string) (Session, error)

func SessionStatus

func SessionStatus(provider string) (Session, string, bool, error)

Jump to

Keyboard shortcuts

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