{"record":{"id":"4d241c57c19a6bb8","repo":"router-for-me/CLIProxyAPI","slug":"pkce-codes-are-required","errorCode":null,"errorMessage":"PKCE codes are required","messagePattern":"PKCE codes are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/auth/claude/anthropic_auth.go","lineNumber":321,"sourceCode":"\t}\n\treturn profile\n}\n\n// GenerateAuthURL creates the OAuth authorization URL with PKCE.\n// This method generates a secure authorization URL including PKCE challenge codes\n// for the OAuth2 flow with Anthropic's API.\n//\n// Parameters:\n//   - state: A random state parameter for CSRF protection\n//   - pkceCodes: The PKCE codes for secure code exchange\n//\n// Returns:\n//   - string: The complete authorization URL\n//   - string: The state parameter for verification\n//   - error: An error if PKCE codes are missing or URL generation fails\nfunc (o *ClaudeAuth) GenerateAuthURL(state string, pkceCodes *PKCECodes) (string, string, error) {\n\tif pkceCodes == nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"PKCE codes are required\")\n\t}\n\n\tparams := url.Values{\n\t\t\"code\":                  {\"true\"},\n\t\t\"client_id\":             {ClientID},\n\t\t\"response_type\":         {\"code\"},\n\t\t\"redirect_uri\":          {RedirectURI},\n\t\t\"scope\":                 {ClaudeOAuthScope},\n\t\t\"code_challenge\":        {pkceCodes.CodeChallenge},\n\t\t\"code_challenge_method\": {\"S256\"},\n\t\t\"state\":                 {state},\n\t}\n\n\tauthURL := fmt.Sprintf(\"%s?%s\", AuthURL, params.Encode())\n\treturn authURL, state, nil\n}\n\n// parseCodeAndState extracts the authorization code and state from the callback response.","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/auth/claude/anthropic_auth.go#L303-L339","documentation":"Error \"PKCE codes are required\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/auth/claude/anthropic_auth.go:321 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide both the PKCE code verifier and authorization code before continuing.","Restart the OAuth flow so the PKCE codes are generated and retained."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}