corebasic 1.0.135 → 1.0.136

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.
Files changed (2) hide show
  1. package/libs/session.js +4 -1
  2. package/package.json +1 -1
package/libs/session.js CHANGED
@@ -45,9 +45,12 @@ export const start = (expressApp, allowedUrls) => {
45
45
  let { userId, clientId, refreshToken } = req.body
46
46
  const decoded = jwt.verify(refreshToken, REFRESH_TOKEN_SECRET)
47
47
  if (decoded.userId === userId && decoded.clientId === clientId) {
48
+ let now = Utils.now()
49
+ let accessTokenExpiry = new Date(now); accessTokenExpiry.setDate(accessTokenExpiry.getDate() + 1); accessTokenExpiry = accessTokenExpiry.getTime()
50
+ let refreshTokenExpiry = new Date(now); refreshTokenExpiry.setDate(refreshTokenExpiry.getDate() + 30); refreshTokenExpiry = refreshTokenExpiry.getTime()
48
51
  const accessToken = jwt.sign({ userId, clientId }, ACCESS_TOKEN_SECRET, { expiresIn: '1d' });
49
52
  const refreshToken = jwt.sign({ userId, clientId }, REFRESH_TOKEN_SECRET, { expiresIn: '30d' });
50
- return res.json({ tokens: { accessToken, refreshToken } });
53
+ return res.json({ tokens: { accessToken, refreshToken, accessTokenExpiry, refreshTokenExpiry} });
51
54
  }
52
55
  // Access Denied
53
56
  throw null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.135",
4
+ "version": "1.0.136",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {