Skip to content

Extract OAuth2 PKCE flow logic into reusable Cypress commands and add new tests#8

Merged
jalexw merged 5 commits intomainfrom
claude/extract-auth-cypress-commands-pmqlc
Mar 31, 2026
Merged

Extract OAuth2 PKCE flow logic into reusable Cypress commands and add new tests#8
jalexw merged 5 commits intomainfrom
claude/extract-auth-cypress-commands-pmqlc

Conversation

@jalexw
Copy link
Copy Markdown
Contributor

@jalexw jalexw commented Mar 30, 2026

Add register_via_resource_server_pkce_flow and login_via_resource_server_pkce_flow
commands to the helper commands package for reuse across E2E tests. Refactor
ExampleResourceServer.cy.ts to use the new commands and add two new tests:
logout-then-login via PKCE, and already-authenticated redirect from /auth/login.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA

… new tests

Add register_via_resource_server_pkce_flow and login_via_resource_server_pkce_flow
commands to the helper commands package for reuse across E2E tests. Refactor
ExampleResourceServer.cy.ts to use the new commands and add two new tests:
logout-then-login via PKCE, and already-authenticated redirect from /auth/login.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA
@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 31, 2026 1:43am

Request Review

claude added 4 commits March 31, 2026 00:37
…er session

After registering via PKCE and logging out of the auth server, the resource
server may still have valid refresh token cookies. The useStartLoginOauthPKCEFlow
hook detects this and redirects to /account instead of starting the PKCE flow.
Clearing all cookies ensures a clean unauthenticated state.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA
…ogin PKCE flow

In development/test environments, the resource server stores refresh tokens
in localStorage (not HTTP-only cookies) since doesSupportHttpOnlyRefreshToken()
returns false for non-auth-server apps in dev/test. Clearing cookies alone
wasn't sufficient to reset the resource server's auth state.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA
cy.clearAllLocalStorage() runs in the auth server origin context and
doesn't effectively clear cross-origin storage. Move localStorage.clear()
inside the cy.origin() block so it executes in the resource server's
origin where the refresh tokens are actually stored.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA
After login with prior consent, the auth server redirects directly to the
resource server (skipping the consent screen). The previous cy.url() check
ran against the auth server origin but the browser had already navigated
to the resource server, causing a cross-origin error. Use cy.get("body")
to check for consent text synchronously instead, which works regardless
of whether the redirect has started.

https://claude.ai/code/session_01Rz2N38ZQkqZUyATUAkcoDA
@jalexw jalexw merged commit 885f1d5 into main Mar 31, 2026
8 checks passed
@jalexw jalexw deleted the claude/extract-auth-cypress-commands-pmqlc branch March 31, 2026 01:56
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