Use same lifespan for cookies as for tokens

This commit is contained in:
Chi Vinh Le
2017-06-05 18:21:40 +07:00
parent 3c96b7eb1e
commit c20df65ebc
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -92,6 +92,7 @@
"minimist": "^1.2.0",
"mongoose": "^4.9.8",
"morgan": "^1.8.1",
"ms": "^2.0.0",
"natural": "^0.5.0",
"node-emoji": "^1.5.1",
"node-fetch": "^1.6.3",
+2 -1
View File
@@ -10,6 +10,7 @@ const uuid = require('uuid');
const debug = require('debug')('talk:passport');
const {createClient} = require('./redis');
const bowser = require('bowser');
const ms = require('ms');
// Create a redis client to use for authentication.
const client = createClient();
@@ -39,7 +40,7 @@ const SetTokenForSafari = (req, res, token) => {
if (browser.ios || browser.safari) {
res.cookie('authorization', token, {
httpOnly: true,
expires: new Date(Date.now() + 900000)
expires: new Date(Date.now() + ms(JWT_EXPIRY))
});
}
};
+4
View File
@@ -5365,6 +5365,10 @@ ms@0.7.3, ms@^0.7.1:
version "0.7.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff"
ms@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
muri@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/muri/-/muri-1.2.1.tgz#ec7ea5ce6ca6a523eb1ab35bacda5fa816c9aa3c"