fix(console): handle OAuth callback errors gracefully by faiyaz032 · Pull Request #47592 · anomalyco/opencode · GitHub
Skip to content

fix(console): handle OAuth callback errors gracefully - #47592

Open
faiyaz032 wants to merge 1 commit into
anomalyco:devfrom
faiyaz032:oauth-callback-errors
Open

fix(console): handle OAuth callback errors gracefully#47592
faiyaz032 wants to merge 1 commit into
anomalyco:devfrom
faiyaz032:oauth-callback-errors

Conversation

@faiyaz032

@faiyaz032 faiyaz032 commented Sep 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #47590
Closes #40232
Closes #39414

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a user cancels sign-in (or something fails on the auth server), the provider redirects back to /auth/callback with an error param instead of a code. The callback only looked for code, so it threw "No authorization code found" and returned a 500 that also echoed the full callback query params (which can include sensitive OAuth values like authorization codes).

This PR makes the callback check error / error_description before requiring code:

  • access_denied is treated as a normal user cancel and redirects back to the auth page.
  • Other OAuth errors return a clean 400 with the actual error message instead of the misleading 500.
  • Removed the cause field that echoed the callback query params in the error response.
  • Valid code flow is unchanged.

How did you verify your code works?

Added unit tests covering success, access_denied, missing code, and other OAuth errors. All pass locally with bun test.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Redirect access_denied back to the auth page, return a clean error for other OAuth errors instead of a 500, and stop echoing callback query params.
Copilot AI lite review requested due to automatic review settings September 6, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

2 participants