@flow-industries/id 0.7.1 → 0.8.1
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.
|
@@ -307,6 +307,17 @@ export function createFlow(options = {}) {
|
|
|
307
307
|
accessKeyPrep = await accessKeyModule.prepareAccessKey(accessKeyOptions, chain.id);
|
|
308
308
|
extraCapabilities = { accessKeyHash: accessKeyPrep.accessKeyHash };
|
|
309
309
|
}
|
|
310
|
+
// When the current session is a guest, forward its access token so a
|
|
311
|
+
// sign-up upgrades that guest in place even where the guest cookie is
|
|
312
|
+
// unreadable (the iOS top-level sign-up popup). The server verifies it
|
|
313
|
+
// before honoring it, so an app that never becomes a guest sends nothing.
|
|
314
|
+
const snapshot = store.getSnapshot();
|
|
315
|
+
if (snapshot.user?.isGuest && snapshot.jwt) {
|
|
316
|
+
extraCapabilities = {
|
|
317
|
+
...(extraCapabilities ?? {}),
|
|
318
|
+
guestToken: snapshot.jwt,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
310
321
|
const { session, webauthn, refreshToken } = await runLogin({
|
|
311
322
|
dialog: dialogHost,
|
|
312
323
|
store,
|
|
@@ -10,6 +10,11 @@ export function makeRefreshStore(host) {
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
set(token) {
|
|
13
|
+
// Never persist a missing token: localStorage.setItem coerces undefined
|
|
14
|
+
// to the literal "undefined", which later reads back as a bogus bearer
|
|
15
|
+
// and 401s as refresh_token_invalid. Fail safe by ignoring it instead.
|
|
16
|
+
if (!token)
|
|
17
|
+
return;
|
|
13
18
|
try {
|
|
14
19
|
localStorage.setItem(key, token);
|
|
15
20
|
}
|
|
@@ -7,6 +7,13 @@ export type ConnectCapabilities = {
|
|
|
7
7
|
accessKeyHash?: string;
|
|
8
8
|
signInHeadless?: boolean;
|
|
9
9
|
credentialId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The current guest's access JWT, forwarded so a sign-up upgrades that guest
|
|
12
|
+
* in place even where the guest cookie is unreadable (the iOS top-level
|
|
13
|
+
* sign-up popup). The server verifies it before letting it stand in for the
|
|
14
|
+
* cookie session; see the register endpoint.
|
|
15
|
+
*/
|
|
16
|
+
guestToken?: string;
|
|
10
17
|
};
|
|
11
18
|
export type ConnectRequest = [{
|
|
12
19
|
capabilities?: ConnectCapabilities;
|