@lumoauth/client 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -346,9 +346,9 @@ const found = await client.auth.checkEmailExists('ada@example.com');
346
346
  // found.exists, found.passwordEnabled, found.passkeyEnabled, found.magicLinkEnabled,
347
347
  // found.hasPasskey, found.hasPushDevice, found.maskedEmail, …
348
348
 
349
- // Email a one-time sign-in link. The result is always { sent: true },
350
- // so the response never reveals whether the account exists.
351
- await client.auth.requestMagicLink({ email: 'ada@example.com', redirectUri: 'https://myapp.example.com/' });
349
+ // Email a one-time sign-in link. The answer is { sent: true } whether or not
350
+ // the account exists, so the response never reveals that.
351
+ await client.auth.requestMagicLink({ email: 'ada@example.com', returnTo: 'https://myapp.example.com/signed-in' });
352
352
 
353
353
  // Sign in with a password on your own form
354
354
  const result = await client.auth.loginWithPassword({ email, password });
@@ -363,6 +363,16 @@ if (result.status === 'complete') {
363
363
  `checkEmailExists` never throws for a network failure or an unknown email. It returns an object
364
364
  in which every flag is `false`, so your screen can fall back to the hosted login page.
365
365
 
366
+ `requestMagicLink` names your application (`clientId`) and sends no cookie. From a browser, the
367
+ origin of your app must be one of the application's allowed origins. The link opens a
368
+ confirmation page at LumoAuth. After the person confirms, they are signed in at LumoAuth and sent
369
+ to `returnTo`: a page of your app on an allowed origin or on the origin of a redirect URI, with at
370
+ most 1,024 characters. Start the PKCE redirect on that page. LumoAuth issues a code without
371
+ showing its own login page. The call throws a `LumoAuthApiError` when the server refuses the
372
+ request. `code` holds the reason: `magic_link_disabled`, `invalid_client`, `origin_not_allowed`,
373
+ `invalid_return_to`, `captcha_required`, `captcha_failed` or `rate_limited`. When the organization
374
+ protects sign-in link requests with a CAPTCHA, pass the token of the widget as `captchaToken`.
375
+
366
376
  `loginWithPassword` returns one of these statuses: `complete`, `mfa_required`,
367
377
  `invalid_credentials`, `blocked`, `inactive`, `rate_limited`, `invalid_request` or `error`. The
368
378
  request is sent with `credentials: 'include'`, so your origin must be in the client's allowed
@@ -702,7 +712,7 @@ Every request and response also has a Zod schema, exported with its type, such a
702
712
  | | `revokeToken(token, accessToken?)` | `void` | `orgId`, `clientId` |
703
713
  | | `getUserInfo(accessToken)` | `UserInfo` | `orgId` |
704
714
  | | `checkEmailExists(email)` | `EmailCheckResult` | `orgId` |
705
- | | `requestMagicLink({ email, redirectUri? })` | `{ sent: true }` | `orgId` |
715
+ | | `requestMagicLink({ email, returnTo?, captchaToken? })` | `{ sent: true }` | `orgId`, `clientId` |
706
716
  | | `loginWithPassword({ email, password })` | `{ status, challengeUrl? }` | `orgId` |
707
717
  | | `passwordGrant(username, password, …)` | `TokenResponse` | older grant; the organization must allow it |
708
718
  | `agents` | `ask(action, context?)` / `isAllowed(action, context?)` | decision / `boolean` | `orgId` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumoauth/client",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "Official LumoAuth browser SDK — OAuth 2.0 PKCE, permissions, Zanzibar (ReBAC), and ABAC for any JavaScript/TypeScript application.",
5
5
  "license": "MIT",
6
6
  "author": "LumoAuth",
@@ -38,7 +38,7 @@
38
38
  "browser"
39
39
  ],
40
40
  "dependencies": {
41
- "@lumoauth/shared": "^1.4.2",
41
+ "@lumoauth/shared": "^1.5.0",
42
42
  "zod": "^4.6.7"
43
43
  },
44
44
  "devDependencies": {