Skip to content

Fix OAuth Connect needing two clicks and then failing - #8

Merged
maxffarrell merged 1 commit into
mainfrom
fix/consent-form-action
Nov 6, 2026
Merged

maxffarrell merged 1 commit into
mainfrom
fix/consent-form-action

Conversation

@maxffarrell

Copy link
Copy Markdown
Owner

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'. CSP form-action also 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 a securitypolicyviolation: form-action event 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 in scripts/oauth-smoke.mjs.

Tested

Real browser: one click now reaches the client callback with code, state and iss. Full production-worker smoke suite passes.

🤖 Generated with Claude Code

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>
@maxffarrell
maxffarrell merged commit e07f94c into main Nov 6, 2026
3 checks passed
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