Repository navigation
Conversation
… helpers Moves the web, fullstack and mobile starters to the SDK releases for the held magic link flow, and rebuilds the Next.js verify page on takeMagicLinkParams and verifyMagicLinkSignIn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the starters to the held magic link flow from fells-code/seamless-auth-api#614 (M6): the emailed link is
/verify-magiclink?token=T#code=C,GET /magic-link/verify/:tokenalways answers 409 withsameDeviceand never signs in, andPOST .../confirmrequires{ code }.Changes
@seamless-auth/react0.21.0 (react-vite, react-oauth, nextjs),@seamless-auth/angular0.6.0,@seamless-auth/vue0.5.0,@seamless-auth/svelte0.5.0,@seamless-auth/nextjs0.11.0 and@seamless-auth/react-native0.6.0, the latest on npm. Lockfiles regenerated. The bundled verify screens in these releases strip the link from the address bar, confirm on their own whensameDeviceis set, and send the code when the reader approves another device.VerifyMagicLink.tsxis rebuilt ontakeMagicLinkParams,verifyMagicLinkSignIn,finishMagicLinkSignIn,confirmMagicLinkSignInandmagicLinkConfirmationPromptfrom@seamless-auth/client, now a direct dependency at^0.11.0because@seamless-auth/reactdoes not re-export them. The page no longer readssearchParams, since the code lives in the fragment, which only the browser sees. The link is read once into a ref and verified once, so the Strict Mode remount neither finds a stripped address nor spends the link twice. The oldauthorizedFetchfallback for SDKs withoutconfirmMagicLinkis gone. The button names and headings are unchanged. Against an older API that sends no code, the helpers still sign in on the verify call.VerifyMagicLink.test.tsxruns the real client helpers against a mocked client. It covers: same-device confirm with the fragment code, once under Strict Mode; the address being stripped while other parameters are kept; an older API signing in on verify; the requesting tab collecting the session; a failed link; and the other-device prompt, approve, failure and decline paths.redirectUriormagicLinkRedirectUri, so every link goes to the API default,<frontend_url>/verify-magiclink. Every web starter that offers magic links serves that exact path: the bundled routes in React, Angular and Vue, SvelteKit'ssrc/routes/verify-magiclink, and the Next.js page. react-oauth offers no magic link. Expo only polls/magic-link/check.AGENTS.mdand the Expo README describe the new flow.patch. Generated projects keep working against older auth APIs.Checks run locally
npm run checkpasses in react-vite, react-oauth, angular, vue, svelte, nextjs and expo.npm run buildpasses in all seven.npm run validateand the rootformat:checkpass.Outside this repo
The seamless-cli harness specs
verify/harness/{react,nextjs}/magicLinkLogin.spec.tsopen/verify-magiclink?token=...without the fragment and assert that every verify request succeeds. Under the new API the verify call always answers 409 and the confirm needs the code. So those specs have to open the capturedmagicLinkUrl, which keeps the#code=, and allow the 409. The Next.js capture route already stores the full URL.