Repository navigation
Fix OAuth Connect needing two clicks and then failing - #8
Merged
Merged
Conversation
The consent page's CSP had form-action 'self'. form-action also governs where a form submission
may be redirected, so browsers dropped the 302 from Connect/Cancel to the client's registered
redirect URI: the first click silently spent the one-time consent ('does nothing') and a second
click failed as already used ('Connection request could not be verified'). Allow exactly the
validated redirect URI's origin (or scheme for native apps), and assert it in the OAuth smoke test.
Verified in a real browser: one click now reaches the client callback with code, state and iss.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Bug
In a real browser, the first Connect click on the OAuth consent page does nothing; a second click shows Connection request could not be verified.
Cause
The consent page's CSP was
form-action 'self'. CSPform-actionalso applies to redirects after a form submission, so the browser blocked the 302 from Connect/Cancel to the client's redirect URI (e.g.https://chatgpt.com/...). The server had already approved and consumed the one-time consent, so the second click failed as already used. Reproduced in a browser with asecuritypolicyviolation: form-actionevent and the callback never reached.Fix
form-action 'self' <registered redirect origin>: only the redirect URI the library already validated (or its scheme for native-app custom schemes). Regression assertion inscripts/oauth-smoke.mjs.Tested
Real browser: one click now reaches the client callback with
code,stateandiss. Full production-worker smoke suite passes.🤖 Generated with Claude Code