MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / GenerateAuthURL

Method GenerateAuthURL

internal/auth/codex/openai_auth.go:66–86  ·  view source on GitHub ↗

GenerateAuthURL creates the OAuth authorization URL with PKCE (Proof Key for Code Exchange). It constructs the URL with the necessary parameters, including the client ID, response type, redirect URI, scopes, and PKCE challenge.

(state string, pkceCodes *PKCECodes)

Source from the content-addressed store, hash-verified

64// It constructs the URL with the necessary parameters, including the client ID,
65// response type, redirect URI, scopes, and PKCE challenge.
66func (o *CodexAuth) GenerateAuthURL(state string, pkceCodes *PKCECodes) (string, error) {
67 if pkceCodes == nil {
68 return "", fmt.Errorf("PKCE codes are required")
69 }
70
71 params := url.Values{
72 "client_id": {ClientID},
73 "response_type": {"code"},
74 "redirect_uri": {RedirectURI},
75 "scope": {"openid email profile offline_access"},
76 "state": {state},
77 "code_challenge": {pkceCodes.CodeChallenge},
78 "code_challenge_method": {"S256"},
79 "prompt": {"login"},
80 "id_token_add_organizations": {"true"},
81 "codex_cli_simplified_flow": {"true"},
82 }
83
84 authURL := fmt.Sprintf("%s?%s", AuthURL, params.Encode())
85 return authURL, nil
86}
87
88// ExchangeCodeForTokens exchanges an authorization code for access and refresh tokens.
89// It performs an HTTP POST request to the OpenAI token endpoint with the provided

Callers 1

LoginMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected