auth

package
v0.0.0-...-d1393d0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenAIClientID     = "app_EMoamEEZ73f0CkXaXp7hrann"
	OpenAIAuthURL      = "https://auth.openai.com/oauth/authorize"
	OpenAITokenURL     = "https://auth.openai.com/oauth/token"
	OpenAICallbackPath = "/auth/callback"
	ClaudeClientID     = "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
	ClaudeAuthURL      = "https://claude.ai/oauth/authorize"
	ClaudeCallbackPath = "/callback"
)

Variables

View Source
var ClaudeCallbackPorts = []int{1461, 1462, 1463, 1464, 1465, 1466}
View Source
var ClaudeScopes = []string{"org:create_api_key", "user:profile", "user:inference", "user:sessions:claude_code", "user:file_upload"}
View Source
var OpenAICallbackPorts = []int{1455, 1456, 1457, 1458, 1459, 1460}
View Source
var OpenAIScopes = []string{"openid", "profile", "email", "offline_access"}

Functions

func ClaudeAuthorizeURL

func ClaudeAuthorizeURL(redirectURI, challenge, state string) string

func DecodeJWT

func DecodeJWT(token string) (map[string]any, error)

func NewState

func NewState() (string, error)

func OpenAIAuthorizeURL

func OpenAIAuthorizeURL(redirectURI, challenge, state string) string

func OpenBrowser

func OpenBrowser(rawurl string) error

Types

type AuthorizeRequest

type AuthorizeRequest struct {
	ClientID    string
	RedirectURI string
	Challenge   string
	State       string
	Scopes      []string
	Extra       url.Values
}

func (AuthorizeRequest) URL

func (r AuthorizeRequest) URL() string

type Callback

type Callback struct {
	// contains filtered or unexported fields
}

func StartClaudeCallback

func StartClaudeCallback(ctx context.Context, expectedState string) (*Callback, error)

func StartOpenAICallback

func StartOpenAICallback(ctx context.Context, expectedState string) (*Callback, error)

func (*Callback) Close

func (c *Callback) Close()

func (*Callback) Port

func (c *Callback) Port() int

func (*Callback) RedirectURI

func (c *Callback) RedirectURI() string

func (*Callback) Wait

func (c *Callback) Wait(ctx context.Context) (CallbackResult, error)

type CallbackResult

type CallbackResult struct {
	Code  string
	State string
}

type Claims

type Claims struct {
	AccountID string
	PlanType  string
	UserID    string
	Email     string
	ExpiresAt time.Time
	Raw       map[string]any
}

func ExtractAccountClaims

func ExtractAccountClaims(accessToken string) (Claims, error)

type PKCE

type PKCE struct {
	Verifier  string
	Challenge string
}

func NewPKCE

func NewPKCE() (PKCE, error)

Jump to

Keyboard shortcuts

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