Skip to content

fix(oauth): surface Meta error body in long-lived token exchange failure - #283

Open
ajianaz wants to merge 1 commit into
developfrom
fix/oauth-step2-error-visibility
Open

ajianaz wants to merge 1 commit into
developfrom
fix/oauth-step2-error-visibility

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Live diagnosis (Sep 23, #281 investigation): OAuth connect showed only
"Failed to get long-lived token: Threads API error: No access_token in
exchange response". Step 1 (code exchange) had already succeeded, so the
real rejection reason from Meta in step 2 (th_exchange_token) was thrown
away by this code path - the error body was never read.

Change

exchange_long_lived_token now extracts Meta's error object (same as
step 1 does) and, when absent, includes the raw response body in the
error message. No behavior change on the success path.

Why it matters

Without the body, admins cannot distinguish: invalid/rotated app secret
vs expired code vs missing scope vs app-mode restrictions. With it, the
next OAuth failure is self-diagnosing.

Refs #281

Step 2 (th_exchange_token) discarded Meta's error object and returned a
generic 'No access_token in exchange response', making real causes
(invalid secret, expired code, permission scope, etc.) impossible to
diagnose from the UI or logs. Step 1 already extracts Meta errors; this
brings step 2 to parity and falls back to including the raw body.

Refs #281
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

⚠️ Review could not complete. LLM API error after retries: Unknown error — check workflow logs


Review powered by cora-code · BYOK · MIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant