fix(oauth): await callback completion before returning success#510
Open
shaun0927 wants to merge 5 commits into
Open
fix(oauth): await callback completion before returning success#510shaun0927 wants to merge 5 commits into
shaun0927 wants to merge 5 commits into
Conversation
feat(oauth): switch Google OAuth from PKCE to authorization code flow…
The callback server was acknowledging success before the asynchronous validation/token-exchange path had actually finished, which could leave users looking at a success page while the flow failed in an unhandled rejection. The handler now awaits callback completion and returns an error page when callback processing fails. Constraint: Needs to remain compatible with the existing full-callback-URL OAuth flow added in prior fixes Rejected: Catch-and-log callback errors without changing the response body | preserves the misleading success UX and hides failure state from users Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep the auth callback response coupled to actual callback completion; do not move async failures back onto an unobserved path Tested: pnpm install; pnpm run deps; apps/main npm run build; source-backed auth callback failure validation JSON Not-tested: Live provider OAuth round-trip against real credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a narrow follow-up to #509 (and adjacent to the earlier OAuth callback work in #431 / #432).
The callback server still returned an
Authorization Successfulpage before the asynchronous callback validation / token-exchange path had actually completed. That could leave users looking at a success page while the flow failed in an unhandled rejection afterward.This patch makes the callback response follow the actual callback outcome: it now awaits
onCallback(url)and returns an error page if callback processing throws.Related issues
Changes
apps/x/apps/main/src/auth-server.tsonCallback(url)Why this scope
I kept the change in
auth-server.tsonly so it corrects the false-success / unhandled-rejection path without changing the broader OAuth flow or provider-specific logic.Testing
cd apps/x && pnpm install && pnpm run depscd apps/main && npm run build{ "status": 200, "bodyIncludesSuccess": false, "bodyIncludesFailure": true, "events": [] }