diff --git a/.changeset/magic-link-fragment-code.md b/.changeset/magic-link-fragment-code.md new file mode 100644 index 0000000..7d02e81 --- /dev/null +++ b/.changeset/magic-link-fragment-code.md @@ -0,0 +1,9 @@ +--- +"seamless-templates": patch +--- + +The web, fullstack and mobile starters move to the Seamless Auth SDK releases that support magic links carrying a code in their fragment (`/verify-magiclink?token=...#code=...`): `@seamless-auth/react` 0.21.0, `@seamless-auth/angular` 0.6.0, `@seamless-auth/vue` 0.5.0, `@seamless-auth/svelte` 0.5.0, `@seamless-auth/nextjs` 0.11.0 and `@seamless-auth/react-native` 0.6.0. The bundled verify screens strip the link from the address bar, confirm on their own when the link is opened on the device that asked for it, and send the code when the reader approves another device. + +The Next.js starter's own verify page now uses `takeMagicLinkParams`, `verifyMagicLinkSignIn`, `finishMagicLinkSignIn` and `confirmMagicLinkSignIn` from `@seamless-auth/client`, a new direct dependency at 0.11.0. It reads the code from the fragment, which only the browser sees, so it no longer takes the token from the page's search parameters. It keeps working against auth APIs that do not send a code. + +No starter passes its own magic link `redirectUri`, so every link goes to the auth API's default, `/verify-magiclink`, which each web starter serves. diff --git a/templates/fullstack/nextjs/AGENTS.md b/templates/fullstack/nextjs/AGENTS.md index 41bcbbf..f763c6b 100644 --- a/templates/fullstack/nextjs/AGENTS.md +++ b/templates/fullstack/nextjs/AGENTS.md @@ -32,11 +32,15 @@ when extending this app is to keep using them, not to rebuild them. and `hasScopedRole`. - `src/components/SignIn.tsx` and `src/components/VerifyMagicLink.tsx`: the sign-in UI, built on `useAuth()` and `useAuthClient()`. -- When a magic link is opened on a different device from the one that asked for it, the auth server - answers the verify call with `409 confirmation_required` and does not spend the link. - `VerifyMagicLink.tsx` then shows which kind of device asked and when, and only on "Yes, sign in - that device" confirms it (`POST /auth/magic-link/verify/{token}/confirm`). The asking device then - signs in through its own poll, never this one. Keep the approval step. +- The emailed link is `/verify-magiclink?token=...#code=...`, and the auth server accepts no other + path unless `magic_link_redirect_uris` is configured. `VerifyMagicLink.tsx` reads it with + `takeMagicLinkParams` (which also strips it from the address bar) and verifies it with + `verifyMagicLinkSignIn` from `@seamless-auth/client`. The server holds every link until it is + confirmed with the fragment's code; the helper confirms on its own when the server reports the + link was opened on the device that asked. Opened on another device, the page shows which kind of + device asked and when, and only on "Yes, sign in that device" calls `confirmMagicLinkSignIn`. The + asking device then signs in through its own poll, never this one. Keep the approval step, and + never read the code from the server or log the link. ## Rules diff --git a/templates/fullstack/nextjs/package-lock.json b/templates/fullstack/nextjs/package-lock.json index 765c66c..b2cca24 100644 --- a/templates/fullstack/nextjs/package-lock.json +++ b/templates/fullstack/nextjs/package-lock.json @@ -9,8 +9,9 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/nextjs": "^0.9.0", - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/nextjs": "^0.11.0", + "@seamless-auth/react": "^0.21.0", "next": "^16.4.6", "react": "^19.2.0", "react-dom": "^19.2.0" @@ -2516,12 +2517,12 @@ "license": "MIT" }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -2531,12 +2532,12 @@ } }, "node_modules/@seamless-auth/core": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/core/-/core-0.25.0.tgz", - "integrity": "sha512-qOYJUNYPKs0UXPg/xbyWG74q16fe7MmXMvNqeV2IRnjl7S1Lsao4rwC06gwz2UZtpuBd3/kbWotCJEo17EXoJw==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/core/-/core-0.27.0.tgz", + "integrity": "sha512-MTbHi0nA/5NW2HjO7WGcmZoj0WPwArIbdMaku7dx4bXsMD4Pksyw82aNByJIRFytEfxCcANXwyHlqfZvkKdCFw==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@types/jsonwebtoken": "^9.0.10", "jose": "^6.1.3", "jsonwebtoken": "^9.0.2" @@ -2546,13 +2547,13 @@ } }, "node_modules/@seamless-auth/nextjs": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/nextjs/-/nextjs-0.9.0.tgz", - "integrity": "sha512-OIpjuIDxG285dJ/RmiTcBCFhWSPQrCyxtRVn1M1KBGDTLSU4aytenlZQYLSXdtZCIP2gY88/VxBbKGPaBmkO3g==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/nextjs/-/nextjs-0.11.0.tgz", + "integrity": "sha512-LZKTMSLuRRdrP54BebDrx0FwL2rzMO+TYNYTmPIvNcFQWKOFxnyxAjxGVEzLQy2Ywgv+3Ab+FLj7jS//5aOcvA==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/core": "^0.25.0", - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/core": "^0.27.0", + "@seamless-auth/types": "^0.40.0", "cookie": "^1.1.1" }, "engines": { @@ -2560,13 +2561,13 @@ } }, "node_modules/@seamless-auth/react": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.20.0.tgz", - "integrity": "sha512-AwWQILnQaEU39MmNoZ3k1bC3jqAFhhZGf9rbmUzhC8dG7wx1295sIvTT+DPPFrSowO47f5Y5PYpTWhCBoshmfg==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.21.0.tgz", + "integrity": "sha512-sdIiELqSXisHMVlFyps0YFL91kd7KA9eFK0QWJw0odO2heRpDjEJAQj07enmtgrV3Va6hFdWnAXSEmRcCgDKog==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0", - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -2586,9 +2587,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -6855,9 +6856,9 @@ } }, "node_modules/jose": { - "version": "6.2.15", - "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.15.tgz", - "integrity": "sha512-qdF6ewcZARtef63fJ9AKKZPgxw+t7USH6HLXYcD4CrdmSvDp79rpJSPFEKc90QBeGS63u1KQtN2MZQHC0yDIzA==", + "version": "6.2.18", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.18.tgz", + "integrity": "sha512-doV4thUwgkrycJH4yLeqwTGIIZphHl+pk7CPReuMIhYhncmgzdko85MaCG4YQFTxqMFr1/oEH32tZuKKovcDEg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/panva" diff --git a/templates/fullstack/nextjs/package.json b/templates/fullstack/nextjs/package.json index 35f4c2f..5dbc7d4 100644 --- a/templates/fullstack/nextjs/package.json +++ b/templates/fullstack/nextjs/package.json @@ -24,8 +24,9 @@ }, "author": "Fells Code LLC", "dependencies": { - "@seamless-auth/nextjs": "^0.9.0", - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/nextjs": "^0.11.0", + "@seamless-auth/react": "^0.21.0", "next": "^16.4.6", "react": "^19.2.0", "react-dom": "^19.2.0" diff --git a/templates/fullstack/nextjs/src/app/verify-magiclink/page.tsx b/templates/fullstack/nextjs/src/app/verify-magiclink/page.tsx index cdcd299..1d16b1e 100644 --- a/templates/fullstack/nextjs/src/app/verify-magiclink/page.tsx +++ b/templates/fullstack/nextjs/src/app/verify-magiclink/page.tsx @@ -1,17 +1,13 @@ import AuthFrame from "@/components/AuthFrame"; import VerifyMagicLink from "@/components/VerifyMagicLink"; -// The auth server builds the emailed link to this path, so it cannot be renamed. -export default async function VerifyMagicLinkPage({ - searchParams, -}: { - searchParams: Promise<{ token?: string | string[] }>; -}) { - const { token } = await searchParams; - +// The auth server builds the emailed link to this exact path, so it cannot be +// renamed. The link's code is in its fragment, which only the browser sees, so +// the client component reads the link rather than this page's searchParams. +export default function VerifyMagicLinkPage() { return ( - + ); } diff --git a/templates/fullstack/nextjs/src/components/VerifyMagicLink.test.tsx b/templates/fullstack/nextjs/src/components/VerifyMagicLink.test.tsx index 8a7f38b..3615ffe 100644 --- a/templates/fullstack/nextjs/src/components/VerifyMagicLink.test.tsx +++ b/templates/fullstack/nextjs/src/components/VerifyMagicLink.test.tsx @@ -1,19 +1,15 @@ import { StrictMode } from "react"; import { act, fireEvent, render, screen } from "@testing-library/react"; +import { SeamlessAuthError } from "@seamless-auth/client"; import { beforeEach, describe, expect, it, vi } from "vitest"; import VerifyMagicLink from "./VerifyMagicLink"; const router = { replace: vi.fn(), refresh: vi.fn() }; -const client: { - verifyMagicLink: ReturnType; - checkMagicLink: ReturnType; - authorizedFetch: ReturnType; - confirmMagicLink?: ReturnType; -} = { +const client = { verifyMagicLink: vi.fn(), + confirmMagicLink: vi.fn(), checkMagicLink: vi.fn(), - authorizedFetch: vi.fn(), }; const auth = { refreshSession: vi.fn() }; const posted: unknown[] = []; @@ -31,72 +27,114 @@ class FakeChannel { close() {} } +const ok = { data: { message: "Success" }, error: null }; +const unauthenticated = { + data: null, + error: new SeamlessAuthError("unauthenticated", 401), +}; +const requestedAt = "2026-10-16T14:05:00.000Z"; + +function heldForConfirmation(sameDevice: boolean, requestedFrom?: object) { + return { + data: null, + error: new SeamlessAuthError("confirmation_required", 409, { + error: "confirmation_required", + message: "Confirm this sign-in.", + requestedFrom: requestedFrom ?? { deviceClass: "macos", requestedAt }, + sameDevice, + }), + }; +} + +function openLink(url = "/verify-magiclink?token=token-1#code=code-1") { + window.history.replaceState(null, "", url); +} + describe("VerifyMagicLink", () => { beforeEach(() => { vi.stubGlobal("BroadcastChannel", FakeChannel); posted.length = 0; router.replace.mockReset(); client.verifyMagicLink.mockReset(); - client.authorizedFetch.mockReset(); - delete client.confirmMagicLink; - client.checkMagicLink - .mockReset() - .mockResolvedValue({ data: { message: "Success" }, error: null }); + client.confirmMagicLink.mockReset().mockResolvedValue(ok); + client.checkMagicLink.mockReset().mockResolvedValue(ok); auth.refreshSession .mockReset() .mockResolvedValue({ data: {}, error: null }); + openLink(); }); - // Strict Mode runs effects twice in development. The link is single use, so - // a second request answers "already used", and treating that as the outcome - // turned every development sign-in by link into a failure. - it("spends the token once under Strict Mode and signs in", async () => { - client.verifyMagicLink.mockResolvedValue({ data: {}, error: null }); + // Strict Mode runs effects twice in development. The link is single use and + // its address is stripped on the first read, so the remount has to reuse the + // first read and the first request. + it("confirms a link opened on the device that asked, once, and signs in", async () => { + client.verifyMagicLink.mockResolvedValue(heldForConfirmation(true)); await act(async () => { render( - + , ); }); expect(client.verifyMagicLink).toHaveBeenCalledTimes(1); - expect(client.checkMagicLink).toHaveBeenCalledTimes(1); + expect(client.verifyMagicLink).toHaveBeenCalledWith("token-1"); + expect(client.confirmMagicLink).toHaveBeenCalledTimes(1); + expect(client.confirmMagicLink).toHaveBeenCalledWith("token-1", "code-1"); expect(router.replace).toHaveBeenCalledWith("/session"); - expect(posted).toEqual([{ type: "MAGIC_LINK_AUTH_SUCCESS" }]); + expect(posted).toContainEqual({ type: "MAGIC_LINK_AUTH_SUCCESS" }); }); - // Opened on another device there is no pre-auth cookie here, so nothing to - // collect: the device that asked signs in, and this one must not pretend to. - it("sends the reader back to the device that asked when no session lands here", async () => { - client.verifyMagicLink.mockResolvedValue({ data: {}, error: null }); - client.checkMagicLink.mockResolvedValue({ - data: null, - error: Object.assign(new Error("unauthenticated"), { status: 401 }), + it("takes the token and code out of the address bar", async () => { + openLink("/verify-magiclink?token=token-1&ref=mail#code=code-1"); + client.verifyMagicLink.mockResolvedValue(heldForConfirmation(true)); + + await act(async () => { + render(); }); - auth.refreshSession.mockResolvedValue({ - data: null, - error: Object.assign(new Error("unauthenticated"), { status: 401 }), + + expect(window.location.pathname).toBe("/verify-magiclink"); + expect(window.location.search).toBe("?ref=mail"); + expect(window.location.hash).toBe(""); + }); + + // An older auth API uses a same-device link on the verify call itself. + it("signs in when the verify call already used the link", async () => { + client.verifyMagicLink.mockResolvedValue(ok); + + await act(async () => { + render(); }); + expect(client.confirmMagicLink).not.toHaveBeenCalled(); + expect(router.replace).toHaveBeenCalledWith("/session"); + }); + + // Opened in another browser on the device that asked there is no pre-auth + // cookie here, so nothing to collect: the tab that asked signs in, and this + // one must not pretend to. + it("sends the reader back to the tab that asked when no session lands here", async () => { + client.verifyMagicLink.mockResolvedValue(heldForConfirmation(true)); + client.checkMagicLink.mockResolvedValue(unauthenticated); + auth.refreshSession.mockResolvedValue(unauthenticated); + await act(async () => { - render(); + render(); }); expect(screen.getByText("You are verified")).toBeInTheDocument(); - expect(posted).toEqual([{ type: "MAGIC_LINK_AUTH_SUCCESS" }]); expect(router.replace).not.toHaveBeenCalled(); }); it("says so when the link has been used or has expired", async () => { client.verifyMagicLink.mockResolvedValue({ data: null, - error: new Error("used"), + error: new SeamlessAuthError("used", 400), }); await act(async () => { - render(); + render(); }); expect(screen.getByText("This link did not work")).toBeInTheDocument(); @@ -104,25 +142,13 @@ describe("VerifyMagicLink", () => { }); describe("when the link is opened on another device", () => { - const requestedAt = "2026-10-16T14:05:00.000Z"; - beforeEach(() => { - client.verifyMagicLink.mockResolvedValue({ - data: null, - error: Object.assign(new Error("confirmation_required"), { - status: 409, - body: { - error: "confirmation_required", - message: "Confirm this sign-in.", - requestedFrom: { deviceClass: "macos", requestedAt }, - }, - }), - }); + client.verifyMagicLink.mockResolvedValue(heldForConfirmation(false)); }); - it("shows where and when the link was requested, without spending it", async () => { + it("shows where and when the link was requested, without using it", async () => { await act(async () => { - render(); + render(); }); const when = new Date(requestedAt).toLocaleString(undefined, { @@ -130,25 +156,21 @@ describe("VerifyMagicLink", () => { timeStyle: "short", }); expect( - screen.getByText(`This link was requested from a Mac, ${when}.`, { + screen.getByText(`A sign-in was requested from a Mac on ${when}.`, { exact: false, }), ).toBeInTheDocument(); expect( screen.getByRole("button", { name: "Yes, sign in that device" }), ).toBeInTheDocument(); + expect(client.confirmMagicLink).not.toHaveBeenCalled(); expect(client.checkMagicLink).not.toHaveBeenCalled(); - expect(posted).toEqual([]); expect(router.replace).not.toHaveBeenCalled(); }); - it("approves through the SDK and sends the reader back to the other device", async () => { - client.confirmMagicLink = vi - .fn() - .mockResolvedValue({ data: { message: "Success" }, error: null }); - + it("approves with the code from the link and sends the reader back", async () => { await act(async () => { - render(); + render(); }); await act(async () => { fireEvent.click( @@ -156,41 +178,19 @@ describe("VerifyMagicLink", () => { ); }); - expect(client.confirmMagicLink).toHaveBeenCalledWith("token-1"); - expect(client.authorizedFetch).not.toHaveBeenCalled(); + expect(client.confirmMagicLink).toHaveBeenCalledWith("token-1", "code-1"); expect(screen.getByText("Sign-in approved")).toBeInTheDocument(); expect(router.replace).not.toHaveBeenCalled(); }); - it("falls back to the /auth route when the SDK has no confirmMagicLink", async () => { - client.authorizedFetch.mockResolvedValue( - new Response(JSON.stringify({ message: "Success" }), { status: 200 }), - ); - - await act(async () => { - render(); - }); - await act(async () => { - fireEvent.click( - screen.getByRole("button", { name: "Yes, sign in that device" }), - ); - }); - - expect(client.authorizedFetch).toHaveBeenCalledWith( - "/auth/magic-link/verify/token%2F1/confirm", - { method: "POST" }, - ); - expect(screen.getByText("Sign-in approved")).toBeInTheDocument(); - }); - it("keeps the choice open when approving fails", async () => { - client.confirmMagicLink = vi.fn().mockResolvedValue({ + client.confirmMagicLink.mockResolvedValue({ data: null, - error: Object.assign(new Error("expired"), { status: 400 }), + error: new SeamlessAuthError("expired", 400), }); await act(async () => { - render(); + render(); }); await act(async () => { fireEvent.click( @@ -206,10 +206,8 @@ describe("VerifyMagicLink", () => { }); it("signs nothing in when the reader declines", async () => { - client.confirmMagicLink = vi.fn(); - await act(async () => { - render(); + render(); }); fireEvent.click( screen.getByRole("button", { name: "No, this wasn't me" }), @@ -218,32 +216,38 @@ describe("VerifyMagicLink", () => { expect(screen.getByText("Nothing was signed in")).toBeInTheDocument(); expect(screen.getByText(/ignore the email/)).toBeInTheDocument(); expect(client.confirmMagicLink).not.toHaveBeenCalled(); - expect(client.authorizedFetch).not.toHaveBeenCalled(); }); it("names an automated client and tolerates a missing time", async () => { client.verifyMagicLink.mockResolvedValue({ data: null, - error: Object.assign(new Error("confirmation_required"), { - status: 409, - body: { details: { requestedFrom: { deviceClass: "bot" } } }, + error: new SeamlessAuthError("confirmation_required", 409, { + details: { + error: "confirmation_required", + requestedFrom: { deviceClass: "bot" }, + sameDevice: false, + }, }), }); await act(async () => { - render(); + render(); }); expect( - screen.getByText("This link was requested from an automated client.", { + screen.getByText("A sign-in was requested from an automated client.", { exact: false, }), ).toBeInTheDocument(); }); }); - it("fails without a token, asking nothing", () => { - render(); + it("fails without a token, asking nothing", async () => { + openLink("/verify-magiclink"); + + await act(async () => { + render(); + }); expect(screen.getByText("This link did not work")).toBeInTheDocument(); expect(client.verifyMagicLink).not.toHaveBeenCalled(); diff --git a/templates/fullstack/nextjs/src/components/VerifyMagicLink.tsx b/templates/fullstack/nextjs/src/components/VerifyMagicLink.tsx index be044e1..134863d 100644 --- a/templates/fullstack/nextjs/src/components/VerifyMagicLink.tsx +++ b/templates/fullstack/nextjs/src/components/VerifyMagicLink.tsx @@ -2,155 +2,85 @@ import { useEffect, useRef, useState } from "react"; import { useRouter } from "next/navigation"; +import { + confirmMagicLinkSignIn, + finishMagicLinkSignIn, + magicLinkConfirmationPrompt, + takeMagicLinkParams, + verifyMagicLinkSignIn, + type MagicLinkParams, + type MagicLinkVerification, +} from "@seamless-auth/client"; import { useAuth, useAuthClient } from "@seamless-auth/react"; import Button from "@/components/Button"; type Status = "verifying" | "confirm" | "approved" | "declined" | "elsewhere" | "failed"; -type AuthClient = ReturnType; -type Verification = ReturnType; - -type RequestedFrom = { deviceClass: string; requestedAt: string }; - -const DEVICE_LABELS: Record = { - ios: "an iPhone or iPad", - android: "an Android device", - macos: "a Mac", - windows: "a Windows PC", - linux: "a Linux computer", - chromeos: "a Chromebook", - bot: "an automated client", - unknown: "an unknown device", -}; - -function readRequestedFrom(body: unknown): RequestedFrom | null { - if (typeof body !== "object" || body === null) return null; - const record = body as Record; - // A proxy in front of the auth server may nest the upstream body under - // `details`. - const source = - record.requestedFrom ?? - (record.details as Record | undefined)?.requestedFrom; - if (typeof source !== "object" || source === null) return null; - const { deviceClass, requestedAt } = source as Record; - return { - deviceClass: typeof deviceClass === "string" ? deviceClass : "unknown", - requestedAt: typeof requestedAt === "string" ? requestedAt : "", - }; -} - -function needsConfirmation(error: unknown): RequestedFrom | null { - if (typeof error !== "object" || error === null) return null; - const { status, body } = error as { status?: unknown; body?: unknown }; - if (status !== 409) return null; - return readRequestedFrom(body) ?? { deviceClass: "unknown", requestedAt: "" }; -} - -function formatRequestedAt(value: string): string | null { - const date = new Date(value); - if (!value || Number.isNaN(date.getTime())) return null; - return date.toLocaleString(undefined, { - dateStyle: "medium", - timeStyle: "short", - }); -} - -// `confirmMagicLink` is newer than some published SDKs, so older ones reach -// the same route through the /auth handler directly. -async function confirmMagicLink( - client: AuthClient, - token: string, -): Promise { - const sdk = client as AuthClient & { - confirmMagicLink?: (token: string) => Promise<{ error: unknown }>; - }; - if (typeof sdk.confirmMagicLink === "function") { - const { error } = await sdk.confirmMagicLink(token); - return !error; - } - try { - const response = await client.authorizedFetch( - `/auth/magic-link/verify/${encodeURIComponent(token)}/confirm`, - { method: "POST" }, - ); - return response.ok; - } catch { - return false; - } -} /** - * Opened from the emailed link. + * Opened from the emailed link, `/verify-magiclink?token=...#code=...`. * - * Verifying the link does not sign in this tab: the session belongs to the - * browser that asked for the link, which collects it from /magic-link/check. - * So after verifying, this page tells that tab (if it is open in this browser) - * and then collects the session itself, which works whenever the link was - * opened in the same browser. Opened anywhere else, there is no session here to - * collect, and the page says to go back to the device that asked. + * The auth server holds every link until it is confirmed with the code from + * the fragment. `verifyMagicLinkSignIn` confirms at once when the server says + * this is the device that asked for the link. Verifying does not sign in this + * tab: the session belongs to the browser that asked, which collects it from + * /magic-link/check, so `finishMagicLinkSignIn` tells that tab and collects + * the session here too when it can, which works whenever the link was opened + * in the same browser. * - * When the auth server sees the link opened on a different device from the - * one that asked, it answers 409 without spending the link, and the reader - * has to approve that other device before it signs in. + * Opened on a different device, the link is not used until the reader + * approves it, and approving signs in the other device, not this one. */ -export default function VerifyMagicLink({ token }: { token?: string }) { +export default function VerifyMagicLink() { const router = useRouter(); const client = useAuthClient(); const { refreshSession } = useAuth(); - const [status, setStatus] = useState(token ? "verifying" : "failed"); - const [requestedFrom, setRequestedFrom] = useState( - null, - ); + const [status, setStatus] = useState("verifying"); + const [prompt, setPrompt] = useState(""); const [confirming, setConfirming] = useState(false); const [confirmError, setConfirmError] = useState(false); - // A link can be used once. React runs this effect twice in development - // (Strict Mode mounts, unmounts and mounts again), and a second request would - // find the token already spent, so the remount reuses the first request. - const verification = useRef<{ token: string; result: Verification } | null>( - null, - ); + // Taking the link strips it from the address bar, and a link can be used + // once. React runs this effect twice in development (Strict Mode mounts, + // unmounts and mounts again), so the remount reuses the first read and the + // first request rather than finding an empty address or a spent link. + const link = useRef(null); + const verification = useRef | null>(null); useEffect(() => { - if (!token) return; + link.current ??= takeMagicLinkParams(); + const { token, code } = link.current; + if (!token) { + setStatus("failed"); + return; + } let active = true; - if (verification.current?.token !== token) { - verification.current = { token, result: client.verifyMagicLink(token) }; - } - const { result } = verification.current; + verification.current ??= verifyMagicLinkSignIn({ client, token, code }); + const result = verification.current; void (async () => { - const { error } = await result; + const outcome = await result; if (!active) return; - if (error) { - const pending = needsConfirmation(error); - if (pending) { - setRequestedFrom(pending); - setStatus("confirm"); - return; - } + if (outcome.status === "confirmation-required") { + setPrompt(magicLinkConfirmationPrompt(outcome.confirmation)); + setStatus("confirm"); + return; + } + if (outcome.status === "failed") { setStatus("failed"); return; } - const channel = new BroadcastChannel("seamless-auth"); - channel.postMessage({ type: "MAGIC_LINK_AUTH_SUCCESS" }); - channel.close(); - - // The other tab may collect it first; either way the session check below - // is what decides. - await client.checkMagicLink(); - const { error: sessionError } = await refreshSession(); + const signedIn = await finishMagicLinkSignIn({ client, refreshSession }); if (!active) return; - if (sessionError) { + if (signedIn === "elsewhere") { setStatus("elsewhere"); return; } - router.replace("/session"); router.refresh(); })(); @@ -158,38 +88,33 @@ export default function VerifyMagicLink({ token }: { token?: string }) { return () => { active = false; }; - }, [token, client, refreshSession, router]); + }, [client, refreshSession, router]); async function approve() { + const { token, code } = link.current ?? { token: null, code: null }; if (!token) return; setConfirming(true); setConfirmError(false); - const ok = await confirmMagicLink(client, token); + const { error } = await confirmMagicLinkSignIn({ client, token, code }); setConfirming(false); - if (ok) { - setStatus("approved"); - } else { + if (error) { setConfirmError(true); + } else { + setStatus("approved"); } } if (status === "confirm") { - const device = - DEVICE_LABELS[requestedFrom?.deviceClass ?? "unknown"] ?? - DEVICE_LABELS.unknown; - const when = formatRequestedAt(requestedFrom?.requestedAt ?? ""); - return (

Sign in on another device?

- This link was requested from {device} - {when ? `, ${when}` : ""}. Approve only if that was you. + {prompt} Approve only if that was you.

{confirmError ? (

- That did not work. The link may have expired. Try again, or request - a new one from the sign-in page. + That did not work. The link may have expired. Request a new one from + the sign-in page.

) : null}
diff --git a/templates/mobile/expo/README.md b/templates/mobile/expo/README.md index 77fdd1f..33f2293 100644 --- a/templates/mobile/expo/README.md +++ b/templates/mobile/expo/README.md @@ -47,7 +47,8 @@ already do both. Both need nothing beyond the companion API running. The code screen uppercases what you type because the auth API's codes are six letters. The magic link screen polls `/magic-link/check` -until the link has been opened anywhere, then the session arrives; no deep link is required. +until the link has been opened and, on a device other than the one that asked, approved. Then +the session arrives; no deep link is required. ## Passkeys need a domain diff --git a/templates/mobile/expo/package-lock.json b/templates/mobile/expo/package-lock.json index ec2f4fe..64acc3e 100644 --- a/templates/mobile/expo/package-lock.json +++ b/templates/mobile/expo/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@expo/metro-runtime": "~57.0.15", - "@seamless-auth/react-native": "^0.5.0", + "@seamless-auth/react-native": "^0.6.0", "expo": "~57.0.0", "expo-constants": "~57.0.18", "expo-linking": "~57.0.10", @@ -3654,12 +3654,12 @@ ] }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -3669,13 +3669,13 @@ } }, "node_modules/@seamless-auth/react-native": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/react-native/-/react-native-0.5.0.tgz", - "integrity": "sha512-eQjOY1VV3sZRTuTB908UW54/qs3b1L6m+t3J3Uc5Uf0hCZpmzsuBiifxyylqDIg83vniSh1d2KYxn56kPX3gKA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/react-native/-/react-native-0.6.0.tgz", + "integrity": "sha512-LzAq8V6ybpn+BtnLafN/qm2Vp80945Y6ZECZc+hF1t6qU5FxCSa8CHm2wpyfe/WoJJHlKi7PPBYk7fF3C8gbtg==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0", - "@seamless-auth/types": "^0.38.0" + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/types": "^0.40.0" }, "engines": { "node": ">=22", @@ -3686,9 +3686,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -7069,9 +7069,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lighthouse-logger": { diff --git a/templates/mobile/expo/package.json b/templates/mobile/expo/package.json index 8020276..9d478a6 100644 --- a/templates/mobile/expo/package.json +++ b/templates/mobile/expo/package.json @@ -26,7 +26,7 @@ "author": "Fells Code LLC", "dependencies": { "@expo/metro-runtime": "~57.0.15", - "@seamless-auth/react-native": "^0.5.0", + "@seamless-auth/react-native": "^0.6.0", "expo": "~57.0.0", "expo-constants": "~57.0.18", "expo-linking": "~57.0.10", diff --git a/templates/web/angular/package-lock.json b/templates/web/angular/package-lock.json index 0fde88d..7117698 100644 --- a/templates/web/angular/package-lock.json +++ b/templates/web/angular/package-lock.json @@ -14,7 +14,7 @@ "@angular/core": "^22.2.0", "@angular/platform-browser": "^22.2.0", "@angular/router": "^22.2.0", - "@seamless-auth/angular": "^0.5.0", + "@seamless-auth/angular": "^0.6.0", "rxjs": "~7.8.0", "tslib": "^2.3.0" }, @@ -3881,12 +3881,12 @@ } }, "node_modules/@seamless-auth/angular": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/angular/-/angular-0.5.0.tgz", - "integrity": "sha512-1uIHWaHvWugbVq2dYnnbKUz3ZSNIWaKl/7wykqNf+Vw1J3RH7Ffn2McypNS3KLWWGsfQZaEIw+fuMwEAwD16Jg==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/angular/-/angular-0.6.0.tgz", + "integrity": "sha512-7fjFNv4Ef0MClMp1B+cpJ+Ry1cpvy5watl0wOuvLoOiqh6HVQxhOvsscZ2PzKNVCxPxSDG7xpoYDcBnsF2uklw==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0", + "@seamless-auth/client": "^0.11.0", "tslib": "^2.7.0" }, "engines": { @@ -3901,12 +3901,12 @@ } }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -3916,9 +3916,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -6533,9 +6533,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lightningcss": { diff --git a/templates/web/angular/package.json b/templates/web/angular/package.json index 93af393..9c088a2 100644 --- a/templates/web/angular/package.json +++ b/templates/web/angular/package.json @@ -31,7 +31,7 @@ "@angular/core": "^22.2.0", "@angular/platform-browser": "^22.2.0", "@angular/router": "^22.2.0", - "@seamless-auth/angular": "^0.5.0", + "@seamless-auth/angular": "^0.6.0", "rxjs": "~7.8.0", "tslib": "^2.3.0" }, diff --git a/templates/web/react-oauth/package-lock.json b/templates/web/react-oauth/package-lock.json index a47a5d9..ee2974e 100644 --- a/templates/web/react-oauth/package-lock.json +++ b/templates/web/react-oauth/package-lock.json @@ -9,7 +9,7 @@ "version": "0.2.1", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/react": "^0.21.0", "@tailwindcss/vite": "^4.1.17", "lucide-react": "^0.554.0", "react": "^19.1.1", @@ -1585,12 +1585,12 @@ ] }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -1600,13 +1600,13 @@ } }, "node_modules/@seamless-auth/react": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.20.0.tgz", - "integrity": "sha512-AwWQILnQaEU39MmNoZ3k1bC3jqAFhhZGf9rbmUzhC8dG7wx1295sIvTT+DPPFrSowO47f5Y5PYpTWhCBoshmfg==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.21.0.tgz", + "integrity": "sha512-sdIiELqSXisHMVlFyps0YFL91kd7KA9eFK0QWJw0odO2heRpDjEJAQj07enmtgrV3Va6hFdWnAXSEmRcCgDKog==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0", - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -1626,9 +1626,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -4038,9 +4038,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lightningcss": { diff --git a/templates/web/react-oauth/package.json b/templates/web/react-oauth/package.json index 768ebf9..a91ea5b 100644 --- a/templates/web/react-oauth/package.json +++ b/templates/web/react-oauth/package.json @@ -25,7 +25,7 @@ }, "author": "Fells Code LLC", "dependencies": { - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/react": "^0.21.0", "@tailwindcss/vite": "^4.1.17", "lucide-react": "^0.554.0", "react": "^19.1.1", diff --git a/templates/web/react-vite/package-lock.json b/templates/web/react-vite/package-lock.json index 82c23c5..f9a73e3 100644 --- a/templates/web/react-vite/package-lock.json +++ b/templates/web/react-vite/package-lock.json @@ -9,7 +9,7 @@ "version": "0.2.1", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/react": "^0.21.0", "@tailwindcss/vite": "^4.1.17", "lucide-react": "^0.554.0", "react": "^19.1.1", @@ -1585,12 +1585,12 @@ ] }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -1600,13 +1600,13 @@ } }, "node_modules/@seamless-auth/react": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.20.0.tgz", - "integrity": "sha512-AwWQILnQaEU39MmNoZ3k1bC3jqAFhhZGf9rbmUzhC8dG7wx1295sIvTT+DPPFrSowO47f5Y5PYpTWhCBoshmfg==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/react/-/react-0.21.0.tgz", + "integrity": "sha512-sdIiELqSXisHMVlFyps0YFL91kd7KA9eFK0QWJw0odO2heRpDjEJAQj07enmtgrV3Va6hFdWnAXSEmRcCgDKog==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0", - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/client": "^0.11.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -1626,9 +1626,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -4038,9 +4038,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lightningcss": { diff --git a/templates/web/react-vite/package.json b/templates/web/react-vite/package.json index 822e166..f90bd4c 100644 --- a/templates/web/react-vite/package.json +++ b/templates/web/react-vite/package.json @@ -24,7 +24,7 @@ }, "author": "Fells Code LLC", "dependencies": { - "@seamless-auth/react": "^0.20.0", + "@seamless-auth/react": "^0.21.0", "@tailwindcss/vite": "^4.1.17", "lucide-react": "^0.554.0", "react": "^19.1.1", diff --git a/templates/web/svelte/package-lock.json b/templates/web/svelte/package-lock.json index 9405ef9..4a2e632 100644 --- a/templates/web/svelte/package-lock.json +++ b/templates/web/svelte/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/svelte": "^0.4.0" + "@seamless-auth/svelte": "^0.5.0" }, "devDependencies": { "@eslint/js": "^10.0.1", @@ -873,12 +873,12 @@ "license": "MIT" }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -888,12 +888,12 @@ } }, "node_modules/@seamless-auth/svelte": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/svelte/-/svelte-0.4.0.tgz", - "integrity": "sha512-rwbz4PkJHktM7Glue0MjlAimT2bIAgFF4UEC5loTJs1Kwz74PFVQRrsq3XbxDOSeRusuSjeHINUkM06cRdinig==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/svelte/-/svelte-0.5.0.tgz", + "integrity": "sha512-1Sb/5YIiWHL7VxqOexy82CnzOS1A8S4XIEB7Xuuj09KAMdIxlQTjsmmM7jKYfzCrj9AeO6oY7QEhQA981gAAfA==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0" + "@seamless-auth/client": "^0.11.0" }, "engines": { "node": ">=22", @@ -910,9 +910,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -2751,9 +2751,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lightningcss": { diff --git a/templates/web/svelte/package.json b/templates/web/svelte/package.json index 3a1082e..19adb3e 100644 --- a/templates/web/svelte/package.json +++ b/templates/web/svelte/package.json @@ -25,7 +25,7 @@ }, "author": "Fells Code LLC", "dependencies": { - "@seamless-auth/svelte": "^0.4.0" + "@seamless-auth/svelte": "^0.5.0" }, "devDependencies": { "@eslint/js": "^10.0.1", diff --git a/templates/web/vue/package-lock.json b/templates/web/vue/package-lock.json index d6fed83..50879c9 100644 --- a/templates/web/vue/package-lock.json +++ b/templates/web/vue/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/vue": "^0.4.0", + "@seamless-auth/vue": "^0.5.0", "vue": "^3.5.42", "vue-router": "^5.3.1" }, @@ -875,12 +875,12 @@ "license": "MIT" }, "node_modules/@seamless-auth/client": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.9.0.tgz", - "integrity": "sha512-CavI+GTQvt/lreVzaFuATWdyg2SqqWVsVXneUgKTKkshHywgkXb4/8V0RTvhfSqRxIn+YRBMlsGbUq4RdSDwSg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/client/-/client-0.11.0.tgz", + "integrity": "sha512-3blp4Vd5o5Hoo5XrsFYoIuRnMNEMjytRbHhPOVWCt+6G6v96hELl98wiMwKisSfUsqOTUdU1EYIHazL+yfaCDQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/types": "^0.38.0", + "@seamless-auth/types": "^0.40.0", "@simplewebauthn/browser": "^13.1.0", "libphonenumber-js": "^1.12.7" }, @@ -890,9 +890,9 @@ } }, "node_modules/@seamless-auth/types": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.38.0.tgz", - "integrity": "sha512-qALF5GFQEv+9yucQdn179cpTdEMMH/PjtZWAHatWk1qUEOzb1ElOqoBZgC4/THAk6u4aLgDyuDt/dCD/BzloqA==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/types/-/types-0.40.0.tgz", + "integrity": "sha512-NpFVCWE0VSNrBK9M4yBxsloyQgGHXP6B8/QmDPxsFz48/qV6jcDqdUpuV4PAJslG9B9X+4BcnTSQzI+iPSRNsA==", "license": "Apache-2.0", "dependencies": { "zod": "^4.5.0" @@ -902,12 +902,12 @@ } }, "node_modules/@seamless-auth/vue": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@seamless-auth/vue/-/vue-0.4.0.tgz", - "integrity": "sha512-VyBkb7Pw9A546pirC5UBJjlhfvZy/Aq44MO9+j/PMKUoSmszyJq+8FzFr+1MlsWkqDHeaEQN5kNhLRfTLUT5xw==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@seamless-auth/vue/-/vue-0.5.0.tgz", + "integrity": "sha512-64FeLw7AplbkqF4E0Xd7SDSMAnn29T/YVJXbf5FcSA6L8Ppk/cT4hbwcKCr6Yien6JzNVKUv3R8zDdlM8UQqkQ==", "license": "Apache-2.0", "dependencies": { - "@seamless-auth/client": "^0.9.0" + "@seamless-auth/client": "^0.11.0" }, "engines": { "node": ">=22", @@ -3213,9 +3213,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.13.15", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.15.tgz", - "integrity": "sha512-AHdhEQeDFEJ4GKDAQ9AwxChy+v2kUILUB3TGQRpkXMkWePjXTU/WQEzWVQoIx/Gz8fE73Wr5SEuZCy2vk8jrMQ==", + "version": "1.13.17", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.17.tgz", + "integrity": "sha512-V92dxRHhYTsHF5B6IjR8rtKW6qL7xKuERPFFqZt7XQl8A+NikbwEzjhxGpM+R6JnWjaL7/wokWSdTG/eyYAscQ==", "license": "MIT" }, "node_modules/lightningcss": { diff --git a/templates/web/vue/package.json b/templates/web/vue/package.json index a8b8248..af82ef3 100644 --- a/templates/web/vue/package.json +++ b/templates/web/vue/package.json @@ -24,7 +24,7 @@ }, "author": "Fells Code LLC", "dependencies": { - "@seamless-auth/vue": "^0.4.0", + "@seamless-auth/vue": "^0.5.0", "vue": "^3.5.42", "vue-router": "^5.3.1" },