From f01b1c73abbf3e5d1aad4effce0ac0e7f0a034c1 Mon Sep 17 00:00:00 2001 From: Fellyph Cintra Date: Thu, 22 Feb 2024 12:54:29 +0000 Subject: [PATCH 1/2] adding extra dot to domain property --- src/demos/storage-access-api/routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demos/storage-access-api/routes.js b/src/demos/storage-access-api/routes.js index f0dad07..cd5961f 100644 --- a/src/demos/storage-access-api/routes.js +++ b/src/demos/storage-access-api/routes.js @@ -31,7 +31,7 @@ router.post( '/set-personalization', ( req, res ) => { } res.cookie('theme', theme, { - domain: res.locals.domainC, + domain: `.${res.locals.domainC}`, maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days httpOnly: true, sameSite: "none", From 99452a6bb2279c79ad57c1c7926a73913ab9f34a Mon Sep 17 00:00:00 2001 From: Fellyph Cintra Date: Mon, 26 Feb 2024 08:00:58 +0000 Subject: [PATCH 2/2] making the domain cosistent --- src/demos/chips/routes.js | 2 +- src/scenarios/analytics/routes.js | 2 +- src/scenarios/payment-gateway/routes.js | 2 +- src/scenarios/personalization/routes.js | 2 +- src/scenarios/single-sign-on/routes.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/demos/chips/routes.js b/src/demos/chips/routes.js index 854acc3..dc64bde 100644 --- a/src/demos/chips/routes.js +++ b/src/demos/chips/routes.js @@ -29,7 +29,7 @@ router.get( '/analytics.js', ( req, res ) => { // Store the analytics ID in a cookie res.cookie( 'analyticsId', analyticsId, { - Domain: res.locals.domainC, + Domain: `.${res.locals.domainC}`, maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days httpOnly: true, sameSite: "none", diff --git a/src/scenarios/analytics/routes.js b/src/scenarios/analytics/routes.js index 3e69dcd..cc64dfb 100644 --- a/src/scenarios/analytics/routes.js +++ b/src/scenarios/analytics/routes.js @@ -34,7 +34,7 @@ router.get('/analytics.js', (req, res) => { // Store the user name in a cookie res.cookie('userName', userName, { - Domain: res.locals.domainC, + Domain: `.${res.locals.domainC}`, maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days httpOnly: true, sameSite: "none", diff --git a/src/scenarios/payment-gateway/routes.js b/src/scenarios/payment-gateway/routes.js index b454de5..69224ab 100644 --- a/src/scenarios/payment-gateway/routes.js +++ b/src/scenarios/payment-gateway/routes.js @@ -19,7 +19,7 @@ router.get( '/payment-form', ( req, res ) => { res.cookie( 'session_id', 'some_random_session_id', { maxAge: 900000, httpOnly: true, - domain: res.locals.domainC, + domain: `.${res.locals.domainC}`, sameSite: 'none', secure: true } ); diff --git a/src/scenarios/personalization/routes.js b/src/scenarios/personalization/routes.js index 8710137..c541a30 100644 --- a/src/scenarios/personalization/routes.js +++ b/src/scenarios/personalization/routes.js @@ -22,7 +22,7 @@ router.post( '/set-personalization', ( req, res ) => { } res.cookie('theme', theme, { - domain: res.locals.domainC, + domain: `.${res.locals.domainC}`, maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days httpOnly: true, sameSite: "none", diff --git a/src/scenarios/single-sign-on/routes.js b/src/scenarios/single-sign-on/routes.js index 77ac535..8e26190 100644 --- a/src/scenarios/single-sign-on/routes.js +++ b/src/scenarios/single-sign-on/routes.js @@ -46,7 +46,7 @@ router.get('/sign-in', (req, res) => { router.post('/validate', (req, res) => { const email = req.body.email; if (email) { - res.cookie('email', email, { maxAge: 900000, httpOnly: true, domain: res.locals.domainC, sameSite: "none", secure: true }); + res.cookie('email', email, { maxAge: 900000, httpOnly: true, domain: `.${res.locals.domainC}`, sameSite: "none", secure: true }); res.render(path.join(__dirname, 'postmessage'), { email: email }); } else { res.status(400).send('Email validation failed');