@molecule/app-auth 1.5.3 → 1.5.5
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.
- package/README.md +115 -35
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +222 -32
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +72 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-18T22:39:00.130Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-auth
|
|
@@ -55,6 +55,14 @@ mirrors the token into the bonded client.
|
|
|
55
55
|
**`getState().status` is the session state to render, in one value.**
|
|
56
56
|
`'loading'` (no decision yet) → `'authenticated'` / `'unauthenticated'`, and
|
|
57
57
|
`'unavailable'` when a stored session exists but the server could not confirm it.
|
|
58
|
+
**A stored token AND a stored user make the FIRST render `'authenticated'`**:
|
|
59
|
+
`initialize()` sets that state synchronously, before any request, and every
|
|
60
|
+
verification settles behind that render. Never hold the first paint on
|
|
61
|
+
`validateSession()` or a `/me` request of your own — a protected page then pays
|
|
62
|
+
an API round trip on every navigation (xr-molecule-flash-m177: ~30 full page
|
|
63
|
+
loads in one pagination spec; its four tests sat at 15.0–15.9 s of a 15 s
|
|
64
|
+
budget and the grader timed two out). Route guards read this same `status`:
|
|
65
|
+
wait only while it is `'loading'`.
|
|
58
66
|
`validateSession()` is the background re-check that produces the last two: call
|
|
59
67
|
it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
|
|
60
68
|
while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
|
|
@@ -64,6 +72,17 @@ KEEPS the token and the user (`'unavailable'`, retryable; the 404 error names
|
|
|
64
72
|
plus its own listener set is a second session store, and it drifts from the
|
|
65
73
|
client's.
|
|
66
74
|
|
|
75
|
+
**Only a 401/403 ENDS a session; no response at all never does.** Every path that
|
|
76
|
+
clears the stored session (`validateSession`, the cookie restore, the initial
|
|
77
|
+
refresh, the background refresh timer) keys on the server REJECTING the
|
|
78
|
+
credential. An aborted request, a dropped connection, or a 5xx arrives with no
|
|
79
|
+
HTTP status (or `status: 0` from `@molecule/app-http`) and says nothing about the
|
|
80
|
+
session: the token and user are kept and the state becomes `'unavailable'` so a
|
|
81
|
+
later load or retry can restore it. An app's own code must use the same test —
|
|
82
|
+
`isAuthFailure(err)` from `@molecule/app-http` (401/403 only) — never
|
|
83
|
+
`err.status < 500`, which is true for an aborted navigation request and signs the
|
|
84
|
+
user out on a route change.
|
|
85
|
+
|
|
67
86
|
**`autoRefresh` does nothing without a refresh token — and must never log the
|
|
68
87
|
user out.** The client schedules a refresh only when `refresh()` could actually
|
|
69
88
|
succeed, i.e. when a refresh token is stored. An API that issues none (the
|
|
@@ -73,6 +92,21 @@ therefore schedules nothing: the session stays until the API answers 401
|
|
|
73
92
|
(`validateSession()` clears it) or the user logs out. `autoRefresh: true`
|
|
74
93
|
against such an API is harmless but pointless — leave it `false`.
|
|
75
94
|
|
|
95
|
+
**Seeding a session from an exchange the app runs itself: `setSession()`.** When an OAuth
|
|
96
|
+
redirect or the app's own sign-in endpoint has already issued the token and returned the
|
|
97
|
+
user, `setSession({ accessToken, user })` stores both and flips the client to
|
|
98
|
+
`authenticated` in one update, so every hook reading the shared client is signed in at once
|
|
99
|
+
(a form's own sign-in code wrote the token and the user with `setAccessToken`/`setUser`,
|
|
100
|
+
which change their field only — the UI stayed signed out and nine browser assertions timed
|
|
101
|
+
out, xr-molecule-flash-m178). `setAccessToken()` and `setUser()` are field setters, not a
|
|
102
|
+
sign-in: neither sets `authenticated`.
|
|
103
|
+
|
|
104
|
+
**A background verification that returns an unchanged user changes nothing.** When
|
|
105
|
+
`validateSession()` (or a reload's restore) answers with the same profile data the client
|
|
106
|
+
already holds, the client keeps the SAME user object and does not notify subscribers — so an
|
|
107
|
+
effect seeded from `user` does not re-run, and a form it fills keeps what has been typed.
|
|
108
|
+
Seed such a form once (on its first load), never on every `user` identity.
|
|
109
|
+
|
|
76
110
|
**A token another tool reads at its own key is a CONFIG field, not a mirror.**
|
|
77
111
|
An e2e suite or host page that expects `localStorage.jwtToken` (the RealWorld
|
|
78
112
|
specs do) is satisfied by `tokenKey: 'jwtToken'` — in a browser the client's
|
|
@@ -345,6 +379,23 @@ interface AuthState<T = UserProfile> {
|
|
|
345
379
|
}
|
|
346
380
|
```
|
|
347
381
|
|
|
382
|
+
#### `AuthSessionSeed`
|
|
383
|
+
|
|
384
|
+
A complete session an exchange outside the client has already established — an OAuth
|
|
385
|
+
code→token redirect, or the app's own sign-in endpoint. {@link AuthClient.setSession} adopts
|
|
386
|
+
it in one update: the token and the user are stored and the client becomes `authenticated`.
|
|
387
|
+
|
|
388
|
+
```typescript
|
|
389
|
+
interface AuthSessionSeed<T = UserProfile> {
|
|
390
|
+
/** The access token the exchange issued. */
|
|
391
|
+
accessToken: string
|
|
392
|
+
/** The profile that token belongs to, as the API returned it. */
|
|
393
|
+
user: T
|
|
394
|
+
/** A refresh token, when the exchange issued one; omitted leaves the stored one untouched. */
|
|
395
|
+
refreshToken?: string | null
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
348
399
|
#### `AuthClient`
|
|
349
400
|
|
|
350
401
|
Auth client interface that all auth bond packages must implement.
|
|
@@ -376,6 +427,11 @@ interface AuthClient<
|
|
|
376
427
|
* hitting the network. Intended for local refreshes after a per-app
|
|
377
428
|
* mutation (e.g., the user just PATCHed their own profile and the
|
|
378
429
|
* server returned the canonical row). Does NOT change tokens.
|
|
430
|
+
*
|
|
431
|
+
* This does not sign the client in: `authenticated` and `status` are
|
|
432
|
+
* unchanged, so an anonymous client stays anonymous. Use
|
|
433
|
+
* {@link login} / {@link register} for a credential exchange, or
|
|
434
|
+
* {@link setSession} when the token was issued outside the client.
|
|
379
435
|
*/
|
|
380
436
|
setUser(user: T | null): void
|
|
381
437
|
|
|
@@ -385,14 +441,34 @@ interface AuthClient<
|
|
|
385
441
|
getAccessToken(): string | null
|
|
386
442
|
|
|
387
443
|
/**
|
|
388
|
-
* Stores the access token in the configured token storage adapter (in
|
|
389
|
-
*
|
|
390
|
-
* the
|
|
391
|
-
*
|
|
392
|
-
*
|
|
444
|
+
* Stores the access token in the configured token storage adapter (in a
|
|
445
|
+
* browser, Web Storage; `'memory'` where no browser store exists). Use this
|
|
446
|
+
* to seed the token after an out-of-band exchange (e.g. the OAuth
|
|
447
|
+
* code→token redirect) instead of writing to `localStorage` directly,
|
|
448
|
+
* which would violate the storage contract and make a stored bearer token
|
|
449
|
+
* JS-readable (XSS-exfiltratable). Pass `null` to clear it.
|
|
450
|
+
*
|
|
451
|
+
* This changes token storage only; it does not sign the client in
|
|
452
|
+
* (`authenticated` and `status` are unchanged). Use {@link login} /
|
|
453
|
+
* {@link register} for a credential exchange, or call {@link setSession}
|
|
454
|
+
* with the token and the user to establish an already-issued session.
|
|
393
455
|
*/
|
|
394
456
|
setAccessToken(token: string | null): void
|
|
395
457
|
|
|
458
|
+
/**
|
|
459
|
+
* Adopts a session an out-of-band exchange already established: stores the
|
|
460
|
+
* access token (and the refresh token when given), caches the user, and
|
|
461
|
+
* sets the COMPLETE state — `initialized`, `authenticated`, `status:
|
|
462
|
+
* 'authenticated'`, no error — in one update, with one subscriber
|
|
463
|
+
* notification. Every hook reading the shared client sees the user as
|
|
464
|
+
* signed in immediately.
|
|
465
|
+
*
|
|
466
|
+
* This is the way to seed an OAuth/custom sign-in. Calling
|
|
467
|
+
* {@link setAccessToken} and {@link setUser} instead does NOT sign the
|
|
468
|
+
* client in.
|
|
469
|
+
*/
|
|
470
|
+
setSession(session: AuthSessionSeed<T>): void
|
|
471
|
+
|
|
396
472
|
/**
|
|
397
473
|
* Gets the refresh token.
|
|
398
474
|
*/
|
|
@@ -441,6 +517,19 @@ interface AuthClient<
|
|
|
441
517
|
|
|
442
518
|
/**
|
|
443
519
|
* Initializes auth state (e.g., from stored tokens).
|
|
520
|
+
*
|
|
521
|
+
* With a stored token AND a stored user it marks the session `'authenticated'`
|
|
522
|
+
* SYNCHRONOUSLY — before its first `await` — so the first render is the
|
|
523
|
+
* signed-in UI and no page waits on a verification round trip. Any check
|
|
524
|
+
* (a refresh, the cookie-restore probe) settles behind that render, and only an
|
|
525
|
+
* explicit 401/403 ends the session; a network/5xx/404 failure keeps it and
|
|
526
|
+
* reports `'unavailable'`. With no stored user the client stays `'loading'`
|
|
527
|
+
* until the cookie restore decides.
|
|
528
|
+
*
|
|
529
|
+
* Do not put this call (or a `/me` request of your own) in front of the first
|
|
530
|
+
* render, and do not render a loading screen over a session it just restored:
|
|
531
|
+
* `whenRestored()` already resolves as soon as the restore has settled, and the
|
|
532
|
+
* HTTP gate built on it holds requests for exactly that window.
|
|
444
533
|
*/
|
|
445
534
|
initialize(): Promise<void>
|
|
446
535
|
|
|
@@ -640,9 +729,23 @@ interface AuthClientConfig {
|
|
|
640
729
|
requestBody?: (kind: 'login' | 'register', payload: Record<string, unknown>) => unknown
|
|
641
730
|
|
|
642
731
|
/**
|
|
643
|
-
* Turn
|
|
732
|
+
* Turn an answer that carries a user into the client's
|
|
644
733
|
* `{ accessToken, refreshToken?, user }` (default: the answer as given).
|
|
645
734
|
* RealWorld, for example: `(data) => ({ accessToken: data.user.token, user: data.user })`.
|
|
735
|
+
*
|
|
736
|
+
* It is the ONE user-shape adapter, and the client applies it on EVERY path
|
|
737
|
+
* that adopts a user from an API answer — `login()`, `register()`,
|
|
738
|
+
* `validateSession()`, the cookie restore `initialize()`/`refresh()` run, the
|
|
739
|
+
* token-refresh answer, and `updateProfile()`. Those answers carry the raw wire
|
|
740
|
+
* user (a current-user route typically answers a bare `{ user }`), so applying
|
|
741
|
+
* the same mapping is what keeps the adapted profile after a reload instead of
|
|
742
|
+
* replacing it with the unadapted one (xr-molecule-flash-m184). A mapper that
|
|
743
|
+
* cannot read a given answer (it throws, or returns no `user`) leaves that
|
|
744
|
+
* answer's user as it came.
|
|
745
|
+
*
|
|
746
|
+
* It is NOT applied to `setSession()` or `setUser()`: those receive a profile
|
|
747
|
+
* the caller already built in this client's shape, not a wire answer.
|
|
748
|
+
*
|
|
646
749
|
* @param data - The parsed response body.
|
|
647
750
|
* @returns The auth result.
|
|
648
751
|
*/
|
|
@@ -705,33 +808,6 @@ interface AuthClientConfig {
|
|
|
705
808
|
* Use this when the server also issues sessions that must never appear
|
|
706
809
|
* signed-in client-side — e.g. an anonymous/guest session whose user row
|
|
707
810
|
* (`isAnonymous`) would otherwise hydrate as a logged-in user. Defaults to
|
|
708
|
-
* accepting every restored user.
|
|
709
|
-
* @param user - The user returned by the restore probe.
|
|
710
|
-
* @returns Whether to establish the client session from this user.
|
|
711
|
-
*/
|
|
712
|
-
shouldRestoreUser?: (user: UserProfile) => boolean
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Refresh the access token before it expires. A no-op unless the API issued a
|
|
716
|
-
* refresh token at login/register — with none stored, nothing is scheduled and
|
|
717
|
-
* the session is never ended by the refresh timer; an API that rejects the
|
|
718
|
-
* access token (401) or an explicit logout ends it instead. Defaults to `true`.
|
|
719
|
-
*/
|
|
720
|
-
autoRefresh?: boolean
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* Refresh tokens this many seconds before expiry.
|
|
724
|
-
*/
|
|
725
|
-
refreshBuffer?: number
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Forgot password / password reset request endpoint.
|
|
729
|
-
*/
|
|
730
|
-
forgotPasswordEndpoint?: string
|
|
731
|
-
|
|
732
|
-
/**
|
|
733
|
-
* Password reset confirmation endpoint.
|
|
734
|
-
*/
|
|
735
811
|
// … truncated — the full declaration is in node_modules/@molecule/app-auth/dist/types.d.ts
|
|
736
812
|
````
|
|
737
813
|
|
|
@@ -1068,7 +1144,11 @@ Peer dependencies:
|
|
|
1068
1144
|
- **An API with its own auth envelope keeps this client.** `requestBody` wraps the
|
|
1069
1145
|
login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
|
|
1070
1146
|
token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
|
|
1071
|
-
and `authScheme: 'Token'` sends `Authorization: Token <jwt
|
|
1147
|
+
and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. `mapAuthResponse` is the
|
|
1148
|
+
ONE user-shape adapter: the client applies it to every answer that carries a user (login,
|
|
1149
|
+
register, `validateSession()`, the cookie restore, a token refresh, `updateProfile()`), so
|
|
1150
|
+
the adapted profile survives a reload instead of being replaced by the raw wire user.
|
|
1151
|
+
Both are fields of the
|
|
1072
1152
|
`AuthClientConfig` the client is CONSTRUCTED with
|
|
1073
1153
|
(`setClient(createJWTAuthClient({ authScheme: 'Token', … }))` in the auth bond), not
|
|
1074
1154
|
properties of a client that already exists. Do not hand-write an auth client for a spec
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAUhB,WAAW,EACZ,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAUhB,WAAW,EACZ,MAAM,YAAY,CAAA;AAmHnB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAEhE,SAAQ,gBAAqB,KAC5B,UAAU,CAAC,CAAC,EAAE,SAAS,CA2xBzB,CAAA"}
|
package/dist/client.js
CHANGED
|
@@ -72,6 +72,41 @@ const hasBrowserStorage = () => {
|
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Whether two user profiles carry the same data.
|
|
77
|
+
*
|
|
78
|
+
* The profile the API returns is plain JSON — objects of scalars, arrays and nested objects —
|
|
79
|
+
* so a structural walk is enough. `JSON.stringify` is not: it compares key order too, and two
|
|
80
|
+
* objects built in a different order would read as a change.
|
|
81
|
+
*
|
|
82
|
+
* @param left - One profile (or `null`).
|
|
83
|
+
* @param right - The other profile (or `null`).
|
|
84
|
+
* @param depth - How deep the walk already is; a profile nested deeper than this is treated as
|
|
85
|
+
* different, which only costs one notification.
|
|
86
|
+
* @returns `true` when both carry the same data.
|
|
87
|
+
*/
|
|
88
|
+
const sameUserData = (left, right, depth = 0) => {
|
|
89
|
+
if (left === right)
|
|
90
|
+
return true;
|
|
91
|
+
if (depth > 8 || left === null || right === null)
|
|
92
|
+
return false;
|
|
93
|
+
if (typeof left !== 'object' || typeof right !== 'object')
|
|
94
|
+
return false;
|
|
95
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
96
|
+
if (!Array.isArray(left) || !Array.isArray(right))
|
|
97
|
+
return false;
|
|
98
|
+
if (left.length !== right.length)
|
|
99
|
+
return false;
|
|
100
|
+
return left.every((value, index) => sameUserData(value, right[index], depth + 1));
|
|
101
|
+
}
|
|
102
|
+
const leftRecord = left;
|
|
103
|
+
const rightRecord = right;
|
|
104
|
+
const leftKeys = Object.keys(leftRecord);
|
|
105
|
+
if (leftKeys.length !== Object.keys(rightRecord).length)
|
|
106
|
+
return false;
|
|
107
|
+
return leftKeys.every((key) => Object.prototype.hasOwnProperty.call(rightRecord, key) &&
|
|
108
|
+
sameUserData(leftRecord[key], rightRecord[key], depth + 1));
|
|
109
|
+
};
|
|
75
110
|
/**
|
|
76
111
|
* Creates a simple JWT-based auth client.
|
|
77
112
|
*
|
|
@@ -139,9 +174,29 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
139
174
|
return 'unauthenticated';
|
|
140
175
|
};
|
|
141
176
|
const setState = (updates) => {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
177
|
+
const previous = state;
|
|
178
|
+
const next = { ...previous, ...updates };
|
|
179
|
+
// A user REFERENCE changes only when its data changes. A background verification
|
|
180
|
+
// (`validateSession`, a reload's cookie restore) answers with a freshly parsed object that
|
|
181
|
+
// usually carries exactly the data already in state; handing that new reference to every
|
|
182
|
+
// subscriber re-runs every effect keyed on `user`, and a form seeded from it resets whatever
|
|
183
|
+
// the user has typed since (xr-molecule-flash-m173: a Settings form wiped the test's bio
|
|
184
|
+
// between `fill` and submit, so the PUT sent `"bio": ""`).
|
|
185
|
+
if (updates.user !== undefined && sameUserData(updates.user, previous.user)) {
|
|
186
|
+
next.user = previous.user;
|
|
187
|
+
}
|
|
188
|
+
const nextState = { ...next, status: deriveStatus(next, updates.status) };
|
|
189
|
+
state = nextState;
|
|
190
|
+
// Nothing the subscriber can observe changed — the same user object, the same flags: do not
|
|
191
|
+
// notify. A listener that renders from this state has nothing new to render.
|
|
192
|
+
const unchanged = previous.status === nextState.status &&
|
|
193
|
+
previous.initialized === nextState.initialized &&
|
|
194
|
+
previous.authenticated === nextState.authenticated &&
|
|
195
|
+
previous.user === nextState.user &&
|
|
196
|
+
previous.loading === nextState.loading &&
|
|
197
|
+
previous.error === nextState.error;
|
|
198
|
+
if (!unchanged)
|
|
199
|
+
notify();
|
|
145
200
|
};
|
|
146
201
|
/**
|
|
147
202
|
* Whether `err` is the client's own "nothing to refresh with" error thrown by
|
|
@@ -184,14 +239,52 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
184
239
|
logger.debug('Token refresh skipped — no refresh token stored; keeping the session until the API rejects the token', err);
|
|
185
240
|
return;
|
|
186
241
|
}
|
|
187
|
-
|
|
188
|
-
|
|
242
|
+
// ONLY the server rejecting the refresh token (401/403) ends the session.
|
|
243
|
+
// A network drop, an aborted request, or a 5xx says nothing about the
|
|
244
|
+
// credential — signing out here did exactly that on every flaky refresh.
|
|
245
|
+
// The API's next 401 (`validateSession`) or an explicit sign-out decides.
|
|
246
|
+
const httpStatus = err.status;
|
|
247
|
+
if (httpStatus === 401 || httpStatus === 403) {
|
|
248
|
+
logger.warn('Token refresh was rejected, signing out', err);
|
|
249
|
+
void client.logout();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
logger.warn('Token refresh failed; keeping the session until the API rejects the token', err);
|
|
189
253
|
});
|
|
190
254
|
}, refreshTime);
|
|
191
255
|
};
|
|
192
256
|
// An API with its own auth envelope (config.requestBody / mapAuthResponse).
|
|
193
257
|
const shapeBody = (kind, payload) => config.requestBody ? config.requestBody(kind, payload) : payload;
|
|
194
258
|
const mapResult = (data) => (config.mapAuthResponse ? config.mapAuthResponse(data) : data);
|
|
259
|
+
/**
|
|
260
|
+
* The user a current-user answer carries, passed through the SAME
|
|
261
|
+
* `mapAuthResponse` that turns a login/register answer into the app's profile
|
|
262
|
+
* shape. Session validation and the cookie restore adopt a user too, and their
|
|
263
|
+
* answer is the raw wire user — storing it as-is replaced the adapted profile a
|
|
264
|
+
* sign-in had cached, so after a reload the app was authenticated without the
|
|
265
|
+
* `id`/`name` it derives from the adapter (xr-molecule-flash-m184: the username
|
|
266
|
+
* and profile link disappeared although `GET /user` answered 200).
|
|
267
|
+
*
|
|
268
|
+
* A mapper written for a login envelope may not be able to read a bare
|
|
269
|
+
* current-user answer; when it throws or yields no user, the answer is used as
|
|
270
|
+
* given — exactly what every path did before this helper.
|
|
271
|
+
*
|
|
272
|
+
* @param data - The parsed current-user (or refresh) response body.
|
|
273
|
+
* @param fallback - The user to keep when no mapping applies.
|
|
274
|
+
* @returns The user in the app's profile shape.
|
|
275
|
+
*/
|
|
276
|
+
const mapCurrentUser = (data, fallback) => {
|
|
277
|
+
if (!config.mapAuthResponse)
|
|
278
|
+
return fallback;
|
|
279
|
+
try {
|
|
280
|
+
const mapped = config.mapAuthResponse(data);
|
|
281
|
+
return mapped?.user ?? fallback;
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
logger.debug('mapAuthResponse could not read the user in this answer; using it as given', error);
|
|
285
|
+
return fallback;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
195
288
|
const fetchAPI = async (endpoint, options = {}) => {
|
|
196
289
|
const url = baseURL + endpoint;
|
|
197
290
|
const headers = {
|
|
@@ -252,13 +345,16 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
252
345
|
const restoreFromSessionCookie = async () => {
|
|
253
346
|
const hasSessionHint = typeof document !== 'undefined' && /(?:^|;\s*)mol_auth=1(?:;|$)/.test(document.cookie);
|
|
254
347
|
if (!hasSessionHint)
|
|
255
|
-
return null;
|
|
348
|
+
return { user: null, attempted: false, rejected: false };
|
|
256
349
|
try {
|
|
257
350
|
const result = await fetchAPI(currentUserEndpoint, {
|
|
258
351
|
method: 'GET',
|
|
259
352
|
credentials: 'include',
|
|
260
353
|
});
|
|
261
|
-
const
|
|
354
|
+
const rawUser = (result?.user ?? null);
|
|
355
|
+
// The same adapter a sign-in's answer goes through — this answer is the
|
|
356
|
+
// wire shape too, and storing it raw dropped the adapted identity.
|
|
357
|
+
const restoredUser = rawUser ? mapCurrentUser(result, rawUser) : null;
|
|
262
358
|
if (restoredUser && shouldRestoreUser && !shouldRestoreUser(restoredUser)) {
|
|
263
359
|
// The server DOES have a session (e.g. an anonymous/guest one), but the
|
|
264
360
|
// app says it must not count as a signed-in client. Stay logged out and
|
|
@@ -266,13 +362,14 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
266
362
|
// httpOnly session cookie is untouched and keeps authenticating API
|
|
267
363
|
// calls (a guest's projects still work).
|
|
268
364
|
clearSessionHintCookie();
|
|
269
|
-
return null;
|
|
365
|
+
return { user: null, attempted: true, rejected: false };
|
|
270
366
|
}
|
|
271
367
|
if (restoredUser) {
|
|
272
368
|
tokenStorage.setUser(restoredUser);
|
|
273
369
|
setState({ authenticated: true, user: restoredUser });
|
|
274
|
-
return restoredUser;
|
|
370
|
+
return { user: restoredUser, attempted: true, rejected: false };
|
|
275
371
|
}
|
|
372
|
+
return { user: null, attempted: true, rejected: false };
|
|
276
373
|
}
|
|
277
374
|
catch (error) {
|
|
278
375
|
const httpStatus = error.status;
|
|
@@ -281,7 +378,7 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
281
378
|
// later loads skip a guaranteed-401 probe; the next login re-sets it.
|
|
282
379
|
if (httpStatus === 401 || httpStatus === 403) {
|
|
283
380
|
clearSessionHintCookie();
|
|
284
|
-
return null;
|
|
381
|
+
return { user: null, attempted: true, rejected: true };
|
|
285
382
|
}
|
|
286
383
|
// Every other failure says nothing about the cookie. A 404 means the
|
|
287
384
|
// configured `currentUserEndpoint` does not exist (a config error the app
|
|
@@ -294,8 +391,17 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
294
391
|
else {
|
|
295
392
|
logger.debug('Session restore skipped — the server could not confirm the cookie', error);
|
|
296
393
|
}
|
|
394
|
+
return {
|
|
395
|
+
user: null,
|
|
396
|
+
attempted: true,
|
|
397
|
+
rejected: false,
|
|
398
|
+
error: httpStatus === 404
|
|
399
|
+
? 'The current-user endpoint was not found. Serve the route or set currentUserEndpoint to it; the stored session was kept.'
|
|
400
|
+
: error instanceof Error
|
|
401
|
+
? error.message
|
|
402
|
+
: 'The session could not be confirmed',
|
|
403
|
+
};
|
|
297
404
|
}
|
|
298
|
-
return null;
|
|
299
405
|
};
|
|
300
406
|
// The body of `initialize()`, kept separate so the client can record the in-flight
|
|
301
407
|
// promise SYNCHRONOUSLY (see `restoreInFlight`): a caller that awaits `initialize()`
|
|
@@ -304,16 +410,26 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
304
410
|
const token = tokenStorage.getAccessToken();
|
|
305
411
|
const user = tokenStorage.getUser();
|
|
306
412
|
if (token && user) {
|
|
413
|
+
// A stored token AND a stored user ARE the session this client holds: set
|
|
414
|
+
// it — synchronously, before the first `await` — so the first render is the
|
|
415
|
+
// signed-in UI and no page has to wait for a verification round trip. Every
|
|
416
|
+
// verification below settles BEHIND that render; only an explicit 401/403
|
|
417
|
+
// ends the session (the same classification `validateSession` uses). A page
|
|
418
|
+
// that waited on its own `/me` call before painting paid a full API round
|
|
419
|
+
// trip on every navigation (xr-molecule-flash-m177: ~30 page loads in one
|
|
420
|
+
// pagination spec, its four tests at 15.0–15.9 s of a 15 s budget).
|
|
421
|
+
setState({
|
|
422
|
+
initialized: true,
|
|
423
|
+
authenticated: true,
|
|
424
|
+
user,
|
|
425
|
+
});
|
|
307
426
|
if (!isTokenExpired(token)) {
|
|
308
|
-
setState({
|
|
309
|
-
initialized: true,
|
|
310
|
-
authenticated: true,
|
|
311
|
-
user,
|
|
312
|
-
});
|
|
313
427
|
scheduleRefresh();
|
|
314
428
|
return;
|
|
315
429
|
}
|
|
316
|
-
//
|
|
430
|
+
// The token is expired, or carries no readable `exp` (an opaque session
|
|
431
|
+
// token: `isTokenExpired` cannot tell). Confirm the session behind the
|
|
432
|
+
// render — never in front of it.
|
|
317
433
|
const refreshToken = tokenStorage.getRefreshToken();
|
|
318
434
|
if (refreshToken) {
|
|
319
435
|
try {
|
|
@@ -321,14 +437,52 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
321
437
|
setState({ initialized: true });
|
|
322
438
|
return;
|
|
323
439
|
}
|
|
324
|
-
catch (
|
|
325
|
-
|
|
326
|
-
|
|
440
|
+
catch (error) {
|
|
441
|
+
const httpStatus = error.status;
|
|
442
|
+
// Only the server REJECTING the refresh token proves the session dead.
|
|
443
|
+
// A network drop or a 5xx is not about the credential, and it used to
|
|
444
|
+
// sign the user out here (the m159 class).
|
|
445
|
+
if (httpStatus === 401 || httpStatus === 403) {
|
|
446
|
+
logger.warn('Initial token refresh was rejected; signing out', error);
|
|
447
|
+
tokenStorage.clear();
|
|
448
|
+
setState({
|
|
449
|
+
initialized: true,
|
|
450
|
+
authenticated: false,
|
|
451
|
+
user: null,
|
|
452
|
+
status: 'unauthenticated',
|
|
453
|
+
});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
logger.warn('Initial token refresh failed; keeping the stored session until the API rejects it', error);
|
|
327
457
|
}
|
|
328
458
|
}
|
|
459
|
+
// [M1-1] Cookie-restore — this is what keeps a refresh / deep-link logged
|
|
460
|
+
// in under the in-memory-token model. See restoreFromSessionCookie above.
|
|
461
|
+
const outcome = await restoreFromSessionCookie();
|
|
462
|
+
if (outcome.rejected) {
|
|
463
|
+
// The only other proof of this session was rejected by the server.
|
|
464
|
+
tokenStorage.clear();
|
|
465
|
+
setState({ initialized: true, authenticated: false, user: null, status: 'unauthenticated' });
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (outcome.attempted && !outcome.user) {
|
|
469
|
+
// The server could not confirm the session — keep the stored token and
|
|
470
|
+
// user, and say the session is unconfirmed instead of signing out over a
|
|
471
|
+
// network failure, a 5xx, or a misplaced current-user route.
|
|
472
|
+
setState({
|
|
473
|
+
initialized: true,
|
|
474
|
+
status: 'unavailable',
|
|
475
|
+
error: outcome.error ?? 'The session could not be confirmed',
|
|
476
|
+
});
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
// Nothing to ask (no refresh token, no cookie hint) or the cookie restored
|
|
480
|
+
// the session: keep the optimistic state.
|
|
481
|
+
setState({ initialized: true });
|
|
482
|
+
return;
|
|
329
483
|
}
|
|
330
|
-
//
|
|
331
|
-
//
|
|
484
|
+
// No stored user: there is no session to paint, so this load stays `'loading'`
|
|
485
|
+
// until the cookie-restore decides it.
|
|
332
486
|
await restoreFromSessionCookie();
|
|
333
487
|
setState({ initialized: true });
|
|
334
488
|
};
|
|
@@ -344,6 +498,30 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
344
498
|
setAccessToken: (token) => {
|
|
345
499
|
tokenStorage.setAccessToken(token);
|
|
346
500
|
},
|
|
501
|
+
setSession: (session) => {
|
|
502
|
+
// NOT passed through `mapAuthResponse`: a seed is not an API answer, it is
|
|
503
|
+
// the profile the caller already built in this client's shape. Mapping it
|
|
504
|
+
// would adapt an adapted profile a second time.
|
|
505
|
+
tokenStorage.setAccessToken(session.accessToken);
|
|
506
|
+
if (session.refreshToken !== undefined) {
|
|
507
|
+
tokenStorage.setRefreshToken(session.refreshToken);
|
|
508
|
+
}
|
|
509
|
+
tokenStorage.setUser(session.user);
|
|
510
|
+
// The COMPLETE state, in one update and one notification: an out-of-band exchange has
|
|
511
|
+
// already proved the session, so `authenticated` must flip with the token. Writing the
|
|
512
|
+
// token and the user with the two field setters leaves the client signed out for every
|
|
513
|
+
// shared hook (xr-molecule-flash-m178: nine navbar/profile assertions read
|
|
514
|
+
// `state.authenticated` and timed out after a successful registration).
|
|
515
|
+
setState({
|
|
516
|
+
initialized: true,
|
|
517
|
+
authenticated: true,
|
|
518
|
+
loading: false,
|
|
519
|
+
user: session.user,
|
|
520
|
+
status: 'authenticated',
|
|
521
|
+
error: null,
|
|
522
|
+
});
|
|
523
|
+
scheduleRefresh();
|
|
524
|
+
},
|
|
347
525
|
getRefreshToken: () => tokenStorage.getRefreshToken(),
|
|
348
526
|
async login(credentials) {
|
|
349
527
|
setState({ loading: true, error: null });
|
|
@@ -456,10 +634,10 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
456
634
|
// (the auth modal's finishAuth, the upgrade-tab focus-return) threw
|
|
457
635
|
// 'No refresh token available' — which silently aborted the modal's
|
|
458
636
|
// signup/login flow right after the account was created.
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
637
|
+
const outcome = await restoreFromSessionCookie();
|
|
638
|
+
if (outcome.user) {
|
|
461
639
|
emitEvent({ type: 'refresh' });
|
|
462
|
-
return { user:
|
|
640
|
+
return { user: outcome.user };
|
|
463
641
|
}
|
|
464
642
|
throw new I18nError('auth.error.noRefreshToken', undefined, 'No refresh token available');
|
|
465
643
|
}
|
|
@@ -467,18 +645,23 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
467
645
|
method: 'POST',
|
|
468
646
|
body: JSON.stringify({ refreshToken }),
|
|
469
647
|
});
|
|
648
|
+
// The refresh answer carries the user too, in the same wire shape a
|
|
649
|
+
// sign-in's does — route it through the same mapper so a token refresh
|
|
650
|
+
// cannot replace the adapted profile with the raw one.
|
|
651
|
+
const user = mapCurrentUser(result, (result?.user ?? null));
|
|
470
652
|
tokenStorage.setAccessToken(result.accessToken || null);
|
|
471
653
|
if (result.refreshToken) {
|
|
472
654
|
tokenStorage.setRefreshToken(result.refreshToken);
|
|
473
655
|
}
|
|
474
|
-
|
|
656
|
+
if (user)
|
|
657
|
+
tokenStorage.setUser(user);
|
|
475
658
|
setState({
|
|
476
659
|
authenticated: true,
|
|
477
|
-
user
|
|
660
|
+
user,
|
|
478
661
|
});
|
|
479
662
|
emitEvent({ type: 'refresh' });
|
|
480
663
|
scheduleRefresh();
|
|
481
|
-
return result;
|
|
664
|
+
return { ...result, user: user ?? result.user };
|
|
482
665
|
},
|
|
483
666
|
async requestPasswordReset(data) {
|
|
484
667
|
await fetchAPI(forgotPasswordEndpoint, {
|
|
@@ -497,9 +680,12 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
497
680
|
method: 'PATCH',
|
|
498
681
|
body: JSON.stringify(data),
|
|
499
682
|
});
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
683
|
+
// The profile route answers with the wire shape as well; map it like every
|
|
684
|
+
// other answer that replaces the cached user.
|
|
685
|
+
const user = mapCurrentUser(result, result) ?? result;
|
|
686
|
+
tokenStorage.setUser(user);
|
|
687
|
+
setState({ user });
|
|
688
|
+
return user;
|
|
503
689
|
},
|
|
504
690
|
async changePassword(oldPassword, newPassword) {
|
|
505
691
|
// Server handler (@molecule/api-resource-user `updatePassword`)
|
|
@@ -541,7 +727,11 @@ export const createJWTAuthClient = (config = {}) => {
|
|
|
541
727
|
// session still valid?" — the background check `initialize()` does not do
|
|
542
728
|
// (it restores from storage without a request by design).
|
|
543
729
|
const result = await fetchAPI(currentUserEndpoint, { method: 'GET' });
|
|
544
|
-
|
|
730
|
+
// The answer is the wire user, not the app's adapted profile: pass it
|
|
731
|
+
// through the same `mapAuthResponse` a sign-in uses before storing it
|
|
732
|
+
// (xr-molecule-flash-m184 — a reload replaced the adapted user with the
|
|
733
|
+
// raw one and the profile link disappeared).
|
|
734
|
+
const user = mapCurrentUser(result, (result?.user ?? tokenStorage.getUser()));
|
|
545
735
|
if (user) {
|
|
546
736
|
tokenStorage.setUser(user);
|
|
547
737
|
setState({
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAgBnF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,uBAAuB,GAAG,GAAY,EAAE;IAC5C,IAAI,CAAC;QACH,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAA;IACpE,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,4EAA4E;QAC5E,6EAA6E;QAC7E,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,M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AO,YAAY,CAAC,cAAc,EAAE,CAAA;QACtC,CAAC;QAED,gBAAgB,CAAC,QAA2B;YAC1C,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAC5B,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC;QAED,OAAO;YACL,IAAI,YAAY,EAAE,CAAC;gBACjB,YAAY,CAAC,YAAY,CAAC,CAAA;gBAC1B,YAAY,GAAG,IAAI,CAAA;YACrB,CAAC;YACD,cAAc,CAAC,KAAK,EAAE,CAAA;YACtB,cAAc,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,14 @@
|
|
|
46
46
|
* **`getState().status` is the session state to render, in one value.**
|
|
47
47
|
* `'loading'` (no decision yet) → `'authenticated'` / `'unauthenticated'`, and
|
|
48
48
|
* `'unavailable'` when a stored session exists but the server could not confirm it.
|
|
49
|
+
* **A stored token AND a stored user make the FIRST render `'authenticated'`**:
|
|
50
|
+
* `initialize()` sets that state synchronously, before any request, and every
|
|
51
|
+
* verification settles behind that render. Never hold the first paint on
|
|
52
|
+
* `validateSession()` or a `/me` request of your own — a protected page then pays
|
|
53
|
+
* an API round trip on every navigation (xr-molecule-flash-m177: ~30 full page
|
|
54
|
+
* loads in one pagination spec; its four tests sat at 15.0–15.9 s of a 15 s
|
|
55
|
+
* budget and the grader timed two out). Route guards read this same `status`:
|
|
56
|
+
* wait only while it is `'loading'`.
|
|
49
57
|
* `validateSession()` is the background re-check that produces the last two: call
|
|
50
58
|
* it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
|
|
51
59
|
* while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
|
|
@@ -55,6 +63,17 @@
|
|
|
55
63
|
* plus its own listener set is a second session store, and it drifts from the
|
|
56
64
|
* client's.
|
|
57
65
|
*
|
|
66
|
+
* **Only a 401/403 ENDS a session; no response at all never does.** Every path that
|
|
67
|
+
* clears the stored session (`validateSession`, the cookie restore, the initial
|
|
68
|
+
* refresh, the background refresh timer) keys on the server REJECTING the
|
|
69
|
+
* credential. An aborted request, a dropped connection, or a 5xx arrives with no
|
|
70
|
+
* HTTP status (or `status: 0` from `@molecule/app-http`) and says nothing about the
|
|
71
|
+
* session: the token and user are kept and the state becomes `'unavailable'` so a
|
|
72
|
+
* later load or retry can restore it. An app's own code must use the same test —
|
|
73
|
+
* `isAuthFailure(err)` from `@molecule/app-http` (401/403 only) — never
|
|
74
|
+
* `err.status < 500`, which is true for an aborted navigation request and signs the
|
|
75
|
+
* user out on a route change.
|
|
76
|
+
*
|
|
58
77
|
* **`autoRefresh` does nothing without a refresh token — and must never log the
|
|
59
78
|
* user out.** The client schedules a refresh only when `refresh()` could actually
|
|
60
79
|
* succeed, i.e. when a refresh token is stored. An API that issues none (the
|
|
@@ -64,6 +83,21 @@
|
|
|
64
83
|
* (`validateSession()` clears it) or the user logs out. `autoRefresh: true`
|
|
65
84
|
* against such an API is harmless but pointless — leave it `false`.
|
|
66
85
|
*
|
|
86
|
+
* **Seeding a session from an exchange the app runs itself: `setSession()`.** When an OAuth
|
|
87
|
+
* redirect or the app's own sign-in endpoint has already issued the token and returned the
|
|
88
|
+
* user, `setSession({ accessToken, user })` stores both and flips the client to
|
|
89
|
+
* `authenticated` in one update, so every hook reading the shared client is signed in at once
|
|
90
|
+
* (a form's own sign-in code wrote the token and the user with `setAccessToken`/`setUser`,
|
|
91
|
+
* which change their field only — the UI stayed signed out and nine browser assertions timed
|
|
92
|
+
* out, xr-molecule-flash-m178). `setAccessToken()` and `setUser()` are field setters, not a
|
|
93
|
+
* sign-in: neither sets `authenticated`.
|
|
94
|
+
*
|
|
95
|
+
* **A background verification that returns an unchanged user changes nothing.** When
|
|
96
|
+
* `validateSession()` (or a reload's restore) answers with the same profile data the client
|
|
97
|
+
* already holds, the client keeps the SAME user object and does not notify subscribers — so an
|
|
98
|
+
* effect seeded from `user` does not re-run, and a form it fills keeps what has been typed.
|
|
99
|
+
* Seed such a form once (on its first load), never on every `user` identity.
|
|
100
|
+
*
|
|
67
101
|
* **A token another tool reads at its own key is a CONFIG field, not a mirror.**
|
|
68
102
|
* An e2e suite or host page that expects `localStorage.jwtToken` (the RealWorld
|
|
69
103
|
* specs do) is satisfied by `tokenKey: 'jwtToken'` — in a browser the client's
|
|
@@ -87,7 +121,11 @@
|
|
|
87
121
|
* - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
|
|
88
122
|
* login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
|
|
89
123
|
* token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
|
|
90
|
-
* and `authScheme: 'Token'` sends `Authorization: Token <jwt
|
|
124
|
+
* and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. `mapAuthResponse` is the
|
|
125
|
+
* ONE user-shape adapter: the client applies it to every answer that carries a user (login,
|
|
126
|
+
* register, `validateSession()`, the cookie restore, a token refresh, `updateProfile()`), so
|
|
127
|
+
* the adapted profile survives a reload instead of being replaced by the raw wire user.
|
|
128
|
+
* Both are fields of the
|
|
91
129
|
* `AuthClientConfig` the client is CONSTRUCTED with
|
|
92
130
|
* (`setClient(createJWTAuthClient({ authScheme: 'Token', … }))` in the auth bond), not
|
|
93
131
|
* properties of a client that already exists. Do not hand-write an auth client for a spec
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiOG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,14 @@
|
|
|
46
46
|
* **`getState().status` is the session state to render, in one value.**
|
|
47
47
|
* `'loading'` (no decision yet) → `'authenticated'` / `'unauthenticated'`, and
|
|
48
48
|
* `'unavailable'` when a stored session exists but the server could not confirm it.
|
|
49
|
+
* **A stored token AND a stored user make the FIRST render `'authenticated'`**:
|
|
50
|
+
* `initialize()` sets that state synchronously, before any request, and every
|
|
51
|
+
* verification settles behind that render. Never hold the first paint on
|
|
52
|
+
* `validateSession()` or a `/me` request of your own — a protected page then pays
|
|
53
|
+
* an API round trip on every navigation (xr-molecule-flash-m177: ~30 full page
|
|
54
|
+
* loads in one pagination spec; its four tests sat at 15.0–15.9 s of a 15 s
|
|
55
|
+
* budget and the grader timed two out). Route guards read this same `status`:
|
|
56
|
+
* wait only while it is `'loading'`.
|
|
49
57
|
* `validateSession()` is the background re-check that produces the last two: call
|
|
50
58
|
* it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
|
|
51
59
|
* while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
|
|
@@ -55,6 +63,17 @@
|
|
|
55
63
|
* plus its own listener set is a second session store, and it drifts from the
|
|
56
64
|
* client's.
|
|
57
65
|
*
|
|
66
|
+
* **Only a 401/403 ENDS a session; no response at all never does.** Every path that
|
|
67
|
+
* clears the stored session (`validateSession`, the cookie restore, the initial
|
|
68
|
+
* refresh, the background refresh timer) keys on the server REJECTING the
|
|
69
|
+
* credential. An aborted request, a dropped connection, or a 5xx arrives with no
|
|
70
|
+
* HTTP status (or `status: 0` from `@molecule/app-http`) and says nothing about the
|
|
71
|
+
* session: the token and user are kept and the state becomes `'unavailable'` so a
|
|
72
|
+
* later load or retry can restore it. An app's own code must use the same test —
|
|
73
|
+
* `isAuthFailure(err)` from `@molecule/app-http` (401/403 only) — never
|
|
74
|
+
* `err.status < 500`, which is true for an aborted navigation request and signs the
|
|
75
|
+
* user out on a route change.
|
|
76
|
+
*
|
|
58
77
|
* **`autoRefresh` does nothing without a refresh token — and must never log the
|
|
59
78
|
* user out.** The client schedules a refresh only when `refresh()` could actually
|
|
60
79
|
* succeed, i.e. when a refresh token is stored. An API that issues none (the
|
|
@@ -64,6 +83,21 @@
|
|
|
64
83
|
* (`validateSession()` clears it) or the user logs out. `autoRefresh: true`
|
|
65
84
|
* against such an API is harmless but pointless — leave it `false`.
|
|
66
85
|
*
|
|
86
|
+
* **Seeding a session from an exchange the app runs itself: `setSession()`.** When an OAuth
|
|
87
|
+
* redirect or the app's own sign-in endpoint has already issued the token and returned the
|
|
88
|
+
* user, `setSession({ accessToken, user })` stores both and flips the client to
|
|
89
|
+
* `authenticated` in one update, so every hook reading the shared client is signed in at once
|
|
90
|
+
* (a form's own sign-in code wrote the token and the user with `setAccessToken`/`setUser`,
|
|
91
|
+
* which change their field only — the UI stayed signed out and nine browser assertions timed
|
|
92
|
+
* out, xr-molecule-flash-m178). `setAccessToken()` and `setUser()` are field setters, not a
|
|
93
|
+
* sign-in: neither sets `authenticated`.
|
|
94
|
+
*
|
|
95
|
+
* **A background verification that returns an unchanged user changes nothing.** When
|
|
96
|
+
* `validateSession()` (or a reload's restore) answers with the same profile data the client
|
|
97
|
+
* already holds, the client keeps the SAME user object and does not notify subscribers — so an
|
|
98
|
+
* effect seeded from `user` does not re-run, and a form it fills keeps what has been typed.
|
|
99
|
+
* Seed such a form once (on its first load), never on every `user` identity.
|
|
100
|
+
*
|
|
67
101
|
* **A token another tool reads at its own key is a CONFIG field, not a mirror.**
|
|
68
102
|
* An e2e suite or host page that expects `localStorage.jwtToken` (the RealWorld
|
|
69
103
|
* specs do) is satisfied by `tokenKey: 'jwtToken'` — in a browser the client's
|
|
@@ -87,7 +121,11 @@
|
|
|
87
121
|
* - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
|
|
88
122
|
* login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
|
|
89
123
|
* token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
|
|
90
|
-
* and `authScheme: 'Token'` sends `Authorization: Token <jwt
|
|
124
|
+
* and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. `mapAuthResponse` is the
|
|
125
|
+
* ONE user-shape adapter: the client applies it to every answer that carries a user (login,
|
|
126
|
+
* register, `validateSession()`, the cookie restore, a token refresh, `updateProfile()`), so
|
|
127
|
+
* the adapted profile survives a reload instead of being replaced by the raw wire user.
|
|
128
|
+
* Both are fields of the
|
|
91
129
|
* `AuthClientConfig` the client is CONSTRUCTED with
|
|
92
130
|
* (`setClient(createJWTAuthClient({ authScheme: 'Token', … }))` in the auth bond), not
|
|
93
131
|
* properties of a client that already exists. Do not hand-write an auth client for a spec
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiOG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -210,6 +210,21 @@ export type AuthEvent = {
|
|
|
210
210
|
* Callback invoked when an authentication event occurs (login, logout, etc.).
|
|
211
211
|
*/
|
|
212
212
|
export type AuthEventListener = (event: AuthEvent) => void;
|
|
213
|
+
/**
|
|
214
|
+
* A complete session an exchange outside the client has already established — an OAuth
|
|
215
|
+
* code→token redirect, or the app's own sign-in endpoint. {@link AuthClient.setSession} adopts
|
|
216
|
+
* it in one update: the token and the user are stored and the client becomes `authenticated`.
|
|
217
|
+
*
|
|
218
|
+
* @template T - The user profile the API returns.
|
|
219
|
+
*/
|
|
220
|
+
export interface AuthSessionSeed<T = UserProfile> {
|
|
221
|
+
/** The access token the exchange issued. */
|
|
222
|
+
accessToken: string;
|
|
223
|
+
/** The profile that token belongs to, as the API returned it. */
|
|
224
|
+
user: T;
|
|
225
|
+
/** A refresh token, when the exchange issued one; omitted leaves the stored one untouched. */
|
|
226
|
+
refreshToken?: string | null;
|
|
227
|
+
}
|
|
213
228
|
/**
|
|
214
229
|
* Auth client interface that all auth bond packages must implement.
|
|
215
230
|
* Provides login/logout/register flows, token management, profile
|
|
@@ -237,6 +252,11 @@ export interface AuthClient<T = UserProfile, TRegister extends Record<string, un
|
|
|
237
252
|
* hitting the network. Intended for local refreshes after a per-app
|
|
238
253
|
* mutation (e.g., the user just PATCHed their own profile and the
|
|
239
254
|
* server returned the canonical row). Does NOT change tokens.
|
|
255
|
+
*
|
|
256
|
+
* This does not sign the client in: `authenticated` and `status` are
|
|
257
|
+
* unchanged, so an anonymous client stays anonymous. Use
|
|
258
|
+
* {@link login} / {@link register} for a credential exchange, or
|
|
259
|
+
* {@link setSession} when the token was issued outside the client.
|
|
240
260
|
*/
|
|
241
261
|
setUser(user: T | null): void;
|
|
242
262
|
/**
|
|
@@ -244,13 +264,32 @@ export interface AuthClient<T = UserProfile, TRegister extends Record<string, un
|
|
|
244
264
|
*/
|
|
245
265
|
getAccessToken(): string | null;
|
|
246
266
|
/**
|
|
247
|
-
* Stores the access token in the configured token storage adapter (in
|
|
248
|
-
*
|
|
249
|
-
* the
|
|
250
|
-
*
|
|
251
|
-
*
|
|
267
|
+
* Stores the access token in the configured token storage adapter (in a
|
|
268
|
+
* browser, Web Storage; `'memory'` where no browser store exists). Use this
|
|
269
|
+
* to seed the token after an out-of-band exchange (e.g. the OAuth
|
|
270
|
+
* code→token redirect) instead of writing to `localStorage` directly,
|
|
271
|
+
* which would violate the storage contract and make a stored bearer token
|
|
272
|
+
* JS-readable (XSS-exfiltratable). Pass `null` to clear it.
|
|
273
|
+
*
|
|
274
|
+
* This changes token storage only; it does not sign the client in
|
|
275
|
+
* (`authenticated` and `status` are unchanged). Use {@link login} /
|
|
276
|
+
* {@link register} for a credential exchange, or call {@link setSession}
|
|
277
|
+
* with the token and the user to establish an already-issued session.
|
|
252
278
|
*/
|
|
253
279
|
setAccessToken(token: string | null): void;
|
|
280
|
+
/**
|
|
281
|
+
* Adopts a session an out-of-band exchange already established: stores the
|
|
282
|
+
* access token (and the refresh token when given), caches the user, and
|
|
283
|
+
* sets the COMPLETE state — `initialized`, `authenticated`, `status:
|
|
284
|
+
* 'authenticated'`, no error — in one update, with one subscriber
|
|
285
|
+
* notification. Every hook reading the shared client sees the user as
|
|
286
|
+
* signed in immediately.
|
|
287
|
+
*
|
|
288
|
+
* This is the way to seed an OAuth/custom sign-in. Calling
|
|
289
|
+
* {@link setAccessToken} and {@link setUser} instead does NOT sign the
|
|
290
|
+
* client in.
|
|
291
|
+
*/
|
|
292
|
+
setSession(session: AuthSessionSeed<T>): void;
|
|
254
293
|
/**
|
|
255
294
|
* Gets the refresh token.
|
|
256
295
|
*/
|
|
@@ -290,6 +329,19 @@ export interface AuthClient<T = UserProfile, TRegister extends Record<string, un
|
|
|
290
329
|
changePassword(oldPassword: string, newPassword: string): Promise<void>;
|
|
291
330
|
/**
|
|
292
331
|
* Initializes auth state (e.g., from stored tokens).
|
|
332
|
+
*
|
|
333
|
+
* With a stored token AND a stored user it marks the session `'authenticated'`
|
|
334
|
+
* SYNCHRONOUSLY — before its first `await` — so the first render is the
|
|
335
|
+
* signed-in UI and no page waits on a verification round trip. Any check
|
|
336
|
+
* (a refresh, the cookie-restore probe) settles behind that render, and only an
|
|
337
|
+
* explicit 401/403 ends the session; a network/5xx/404 failure keeps it and
|
|
338
|
+
* reports `'unavailable'`. With no stored user the client stays `'loading'`
|
|
339
|
+
* until the cookie restore decides.
|
|
340
|
+
*
|
|
341
|
+
* Do not put this call (or a `/me` request of your own) in front of the first
|
|
342
|
+
* render, and do not render a loading screen over a session it just restored:
|
|
343
|
+
* `whenRestored()` already resolves as soon as the restore has settled, and the
|
|
344
|
+
* HTTP gate built on it holds requests for exactly that window.
|
|
293
345
|
*/
|
|
294
346
|
initialize(): Promise<void>;
|
|
295
347
|
/**
|
|
@@ -463,9 +515,23 @@ export interface AuthClientConfig {
|
|
|
463
515
|
*/
|
|
464
516
|
requestBody?: (kind: 'login' | 'register', payload: Record<string, unknown>) => unknown;
|
|
465
517
|
/**
|
|
466
|
-
* Turn
|
|
518
|
+
* Turn an answer that carries a user into the client's
|
|
467
519
|
* `{ accessToken, refreshToken?, user }` (default: the answer as given).
|
|
468
520
|
* RealWorld, for example: `(data) => ({ accessToken: data.user.token, user: data.user })`.
|
|
521
|
+
*
|
|
522
|
+
* It is the ONE user-shape adapter, and the client applies it on EVERY path
|
|
523
|
+
* that adopts a user from an API answer — `login()`, `register()`,
|
|
524
|
+
* `validateSession()`, the cookie restore `initialize()`/`refresh()` run, the
|
|
525
|
+
* token-refresh answer, and `updateProfile()`. Those answers carry the raw wire
|
|
526
|
+
* user (a current-user route typically answers a bare `{ user }`), so applying
|
|
527
|
+
* the same mapping is what keeps the adapted profile after a reload instead of
|
|
528
|
+
* replacing it with the unadapted one (xr-molecule-flash-m184). A mapper that
|
|
529
|
+
* cannot read a given answer (it throws, or returns no `user`) leaves that
|
|
530
|
+
* answer's user as it came.
|
|
531
|
+
*
|
|
532
|
+
* It is NOT applied to `setSession()` or `setUser()`: those receive a profile
|
|
533
|
+
* the caller already built in this client's shape, not a wire answer.
|
|
534
|
+
*
|
|
469
535
|
* @param data - The parsed response body.
|
|
470
536
|
* @returns The auth result.
|
|
471
537
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IACxF;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAE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