openvibers/openvibe.mediahub Commits
Sign-in no longer hangs on phones (no Clear-Site-Data on the callback or sign-out) (#166)
Changes
@@@ -234,9 +234,8 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dattry {const data = await tokenGrant({ grant_type: 'authorization_code', code: String(code), redirect_uri: redirectUriFor(req), code_verifier: flow.verifier });setSession(res, data);-- // Whatever this browser kept of the site was rendered for a guest: drop it, so the page it returns to-- // (and Back) is drawn for the person who just signed in.-- res.set('Clear-Site-Data', '"cache"');++ // No Clear-Site-Data here or on sign-out: Chrome holds such an answer (and the cookies it sets) until the++ // cache is cleared, which on phones left people on the account chooser with no session (2026-10-28).return res.redirect(next);} catch (err) {log.warn('[OpenVibe.MediaHub] sign-in exchange failed:', err.status || '', err.error || '');@@@ -274,7 +273,6 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dat}).catch(() => {});}clearSession(res);-- res.set('Clear-Site-Data', '"cache"');res.cookie(HINT_COOKIE, 'guest', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });res.redirect(303, sanitizeNext(req.query.next, config));});@@@ -66,9 +66,9 @@ const { signJwt } = require('./helpers/mocks');assert.strictEqual(JSON.parse(flow).next, '/v/5902');});-- await check('signing out clears what the browser kept of the site', async () => {++ await check('signing out sends no Clear-Site-Data (Chrome holds such an answer until its cache is cleared: phones hung, 2026-10-28)', async () => {const out = await s.get('/auth/logout', { as: staff, headers: { 'sec-fetch-site': 'same-origin' } });-- assert.strictEqual(out.headers.get('clear-site-data'), '"cache"');++ assert.strictEqual(out.headers.get('clear-site-data'), null);});await check('another site cannot sign a person out; this site can', async () => {
@@ -234,9 +234,8 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dat
@@ -234,9 +234,8 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dat
try {
try {
const data = await tokenGrant({ grant_type: 'authorization_code', code: String(code), redirect_uri: redirectUriFor(req), code_verifier: flow.verifier });
const data = await tokenGrant({ grant_type: 'authorization_code', code: String(code), redirect_uri: redirectUriFor(req), code_verifier: flow.verifier });
setSession(res, data);
setSession(res, data);
- // Whatever this browser kept of the site was rendered for a guest: drop it, so the page it returns to
- // (and Back) is drawn for the person who just signed in.
- res.set('Clear-Site-Data', '"cache"');
+ // No Clear-Site-Data here or on sign-out: Chrome holds such an answer (and the cookies it sets) until the
+ // cache is cleared, which on phones left people on the account chooser with no session (2026-10-28).
return res.redirect(next);
return res.redirect(next);
} catch (err) {
} catch (err) {
log.warn('[OpenVibe.MediaHub] sign-in exchange failed:', err.status || '', err.error || '');
log.warn('[OpenVibe.MediaHub] sign-in exchange failed:', err.status || '', err.error || '');
@@ -274,7 +273,6 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dat
@@ -274,7 +273,6 @@ function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Dat
}).catch(() => {});
}).catch(() => {});
}
}
clearSession(res);
clearSession(res);
- res.set('Clear-Site-Data', '"cache"');
res.cookie(HINT_COOKIE, 'guest', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });
res.cookie(HINT_COOKIE, 'guest', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });
res.redirect(303, sanitizeNext(req.query.next, config));
res.redirect(303, sanitizeNext(req.query.next, config));
});
});
@@ -66,9 +66,9 @@ const { signJwt } = require('./helpers/mocks');
@@ -66,9 +66,9 @@ const { signJwt } = require('./helpers/mocks');
assert.strictEqual(JSON.parse(flow).next, '/v/5902');
assert.strictEqual(JSON.parse(flow).next, '/v/5902');
});
});
- await check('signing out clears what the browser kept of the site', async () => {
+ await check('signing out sends no Clear-Site-Data (Chrome holds such an answer until its cache is cleared: phones hung, 2026-10-28)', async () => {
const out = await s.get('/auth/logout', { as: staff, headers: { 'sec-fetch-site': 'same-origin' } });
const out = await s.get('/auth/logout', { as: staff, headers: { 'sec-fetch-site': 'same-origin' } });
- assert.strictEqual(out.headers.get('clear-site-data'), '"cache"');
+ assert.strictEqual(out.headers.get('clear-site-data'), null);
});
});
await check('another site cannot sign a person out; this site can', async () => {
await check('another site cannot sign a person out; this site can', async () => {