propro-utils 1.3.23 → 1.3.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -57,14 +57,22 @@ function proproAuthMiddleware(options = {}) {
57
57
  redirectUri
58
58
  );
59
59
 
60
+ const currentDateTime = new Date();
61
+
62
+ const refreshMaxAge = tokenData.tokens.refresh.expires.getTime() - currentDateTime.getTime();
63
+
60
64
  res.cookie("x-refresh-token", tokenData.tokens.refresh.token, {
61
65
  httpOnly: true,
62
66
  secure: process.env.NODE_ENV === "production",
67
+ maxAge: refreshMaxAge
63
68
  });
64
69
 
70
+ const accessMaxAge = tokenData.tokens.access.expires.getTime() - currentDateTime.getTime();
71
+
65
72
  res.cookie("x-access-token", tokenData.tokens.access.token, {
66
73
  httpOnly: true,
67
74
  secure: process.env.NODE_ENV === "production",
75
+ maxAge: accessMaxAge
68
76
  });
69
77
 
70
78
  const redirectUrl = `http://${tokenData.redirectUrl}/`;