diff --git a/CONSUMING.md b/CONSUMING.md index f262f95..682a7c7 100644 --- a/CONSUMING.md +++ b/CONSUMING.md @@ -184,6 +184,17 @@ redirects there directly after login — the absolute-URL redirect avoids the double-prefix issue (`/auth/auth/...`) that arises when a relative `redirect()` path collides with React Router's basename prepend. +> **Fixed in v0.2.2 — `return_to` dropped at the login button.** A +> hosted `ampl-auth` service deployed at **v0.2.1 or earlier** dropped +> `return_to` on the login page: the "Continue with GitHub" button did +> not forward the param into the OAuth start link, so the callback always +> landed the user at `/auth` instead of the deep-link destination. This is +> a **service-side fix** — it takes effect when the shared `ampl.tools/auth` +> service is deployed at v0.2.2, and benefits every consumer at once. +> Consumers do not need to change any code; bumping the pinned +> `@ampl/kit` ref to `#v0.2.2` simply keeps the vendored types in step. +> (Calamus, pinned at `#v0.2.1`, is one affected consumer.) + --- ## Git dependency — pinning and updating @@ -506,12 +517,16 @@ The git tag is the contract for `@ampl/kit`. Consumers pin to an exact tag: "@ampl/kit": "github:UCSB-AMPLab/ampl-kit#v0.2.1" ``` -**This release:** `v0.2.1` exports the `send()` RPC contract (`SendMessage`, -`SendResult`) from `./email` so consumers type their `EMAIL` service binding -against the published contract instead of vendoring it — additive, no breaking -change. (`v0.2.0` added the `./email` subpath itself: `renderEmailShell`, -`buildIcs`, `EmailShellInput`, `EmailBlock`, `IcsEvent`.) Consumers on `v0.1.0` -are unaffected — the `./auth` and `./ui` subpaths are unchanged. +**This release:** `v0.2.2` fixes a `return_to` bug in the hosted `ampl-auth` +service: the login page dropped `return_to` at the "Continue with GitHub" +button, so deep-link-after-login always landed at `/auth` (see the note in +section 4). It is a service-side fix with no library API change — every +consuming tool benefits once the shared service is deployed at v0.2.2, and no +consumer code change is required. (`v0.2.1` exported the `send()` RPC contract — +`SendMessage`, `SendResult` — from `./email`; `v0.2.0` added the `./email` +subpath itself: `renderEmailShell`, `buildIcs`, `EmailShellInput`, `EmailBlock`, +`IcsEvent`.) Consumers on `v0.1.0` are unaffected at the library level — the +`./auth` and `./ui` subpaths are unchanged. **Policy:** diff --git a/app/routes/auth.login.tsx b/app/routes/auth.login.tsx index 5a6582f..77a1d89 100644 --- a/app/routes/auth.login.tsx +++ b/app/routes/auth.login.tsx @@ -12,13 +12,16 @@ * Applies the AMPL design language: kit Button + AuthError. * * Component behaviour: - * - Renders a kit Button ("Continue with GitHub") → withBase("/github"). + * - Renders a kit Button ("Continue with GitHub") → withBase("/github"), + * forwarding any ?return_to= (percent-encoded) onto the start link so the + * deep-link destination survives the OAuth round-trip. Without this the + * param is dropped at the button and the user lands at /auth after login. * - Reads ?error= from useSearchParams() and renders AuthError with the * matching errors.* i18n key via the existing t(`errors.${errorCode}`, * { defaultValue }) safe pattern. * - Bilingual via the common namespace (login.* + errors.*). * - * @version v0.1.0 + * @version v0.2.2 */ import { useSearchParams } from "react-router"; @@ -36,6 +39,15 @@ export default function LoginPage() { const [searchParams] = useSearchParams(); const errorCode = searchParams.get("error"); + // Forward the deep-link destination into the OAuth start link. Without this + // the param is dropped at the button, so auth.github sets an empty + // github_return_to cookie and the callback lands the user at /auth instead + // of where they were heading. Encoded so the path survives the round-trip. + const returnTo = searchParams.get("return_to"); + const githubHref = withBase( + "/github" + (returnTo ? `?return_to=${encodeURIComponent(returnTo)}` : ""), + ); + return (
@@ -47,7 +59,7 @@ export default function LoginPage() { /> )} -