Skip to content

Add OAuth2 PKCE registration E2E test for example resource server#7

Merged
jalexw merged 8 commits intomainfrom
claude/add-pkce-registration-test-ENpmD
Mar 30, 2026
Merged

Add OAuth2 PKCE registration E2E test for example resource server#7
jalexw merged 8 commits intomainfrom
claude/add-pkce-registration-test-ENpmD

Conversation

@jalexw
Copy link
Copy Markdown
Contributor

@jalexw jalexw commented Mar 30, 2026

Tests the full cross-origin PKCE flow: admin creates invite code,
new user visits example app, clicks Register, gets redirected to
auth server, fills registration form, approves consent screen,
and lands on the protected /account page.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2

claude added 2 commits March 30, 2026 16:25
Tests the full cross-origin PKCE flow: admin creates invite code,
new user visits example app, clicks Register, gets redirected to
auth server, fills registration form, approves consent screen,
and lands on the protected /account page.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
auth Ignored Ignored Mar 30, 2026 5:22pm

Request Review

claude added 6 commits March 30, 2026 16:35
The Dockerfile sets PORT=80, but docker-compose was exposing and
mapping port 3007. Fixed to expose port 80 internally (matching
the container) and map host 3007 to container 80. Updated the
EXAMPLE_NEXTJS_RESOURCE_SERVER_URL env var to use port 80 for
inter-container communication.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
Cypress requires cy.origin() when interacting with elements on a
different origin than the base URL. Added cy.origin() blocks for:
- Visiting and interacting with the example app (click Register)
- Verifying the /account page after redirect back to the example app

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
new URL(url).origin strips the default :80 port, matching how
browsers and Cypress normalize origins. Previously cy.origin()
received `:80` in the URL while the browser had already stripped
it, causing a "same origin" error.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
cy.visit() to a cross-origin URL handles the origin transition
automatically — commands run directly on the visited page. Only
the final redirect back from auth server to example app needs
cy.origin() since that navigation happens via JS redirect, not
cy.visit().

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
cy.origin() must wrap the entire cross-origin interaction including
the visit. Placing cy.visit() inside cy.origin() makes it relative
to the example app origin, letting Cypress properly manage the
cross-origin context from the start.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
The browser normalises http://host:80 to http://host (port 80 is
the HTTP default). The auth server's CORS validation does a strict
string comparison between the browser's Origin header and the
registered app domain. With :80 in the registered domain, CORS
rejects the token exchange request, causing the PKCE flow to fail
silently and redirect the user to / instead of /account.

https://claude.ai/code/session_01SHq9hQdUiZTD9Huz2gMNZ2
@jalexw jalexw merged commit bcc8efe into main Mar 30, 2026
8 checks passed
@jalexw jalexw deleted the claude/add-pkce-registration-test-ENpmD branch March 30, 2026 17:28
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.

2 participants