Skip to content

Fix return_to drop on the login page (v0.2.2)#4

Merged
juancobo merged 2 commits into
mainfrom
release/v0.2.2
May 30, 2026
Merged

Fix return_to drop on the login page (v0.2.2)#4
juancobo merged 2 commits into
mainfrom
release/v0.2.2

Conversation

@juancobo

Copy link
Copy Markdown
Member

Summary

The login page dropped return_to, so deep-link-after-login always landed the user at /auth instead of their destination. The "Continue with GitHub" button forwarded the error param but not return_to, so the OAuth start route stored an empty github_return_to cookie and the callback fell back to the base path.

Fix

Read return_to from the login URL and append it (percent-encoded) to the GitHub OAuth start link, preserving the existing error handling. Presentation-only — no loader.

Scope

  • Service-side fix to the hosted ampl-auth login page. The @ampl/kit package API (./ui, ./auth, ./email) is unchanged — consumers pinning v0.2.2 get the same package code as v0.2.1; the fix takes effect when the auth service is deployed.
  • No D1 migrations.

Tests

  • Login page renders the GitHub button with the encoded return_to; parity case with no return_to.
  • A forwarded return_to lands (decoded) in the github_return_to cookie.
  • Existing callback tests already cover the cookie -> redirect step in both directions.

Full suite green (139 tests); typecheck clean.

juancobo added 2 commits May 30, 2026 09:55
The login page dropped return_to: the "Continue with GitHub" button read
the error param but never forwarded return_to, so the OAuth start route
stored an empty github_return_to cookie and the callback redirected to
/auth instead of the deep-link destination. Read return_to from the URL
and append it (encoded) to the start link, preserving the error handling.
Add tests for the login-button forwarding (with a no-return_to parity
case) and for a forwarded return_to landing in the github_return_to cookie.
Service-side fix to the hosted auth login page; no change to the
@ampl/kit package API. Note the affected versions in CONSUMING.md.
Copilot AI review requested due to automatic review settings May 30, 2026 16:56
@juancobo juancobo merged commit 05c59f6 into main May 30, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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