@agilesoft/ags_authrest2 1.0.2 → 1.0.3

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/index.js +13 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -132,10 +132,22 @@ class Auth {
132
132
  var isExpiredToken = false;
133
133
 
134
134
  var dateNow = new Date();
135
+ if (payload.exp.toString().length > 10) {
136
+ payload.exp = parseInt(payload.exp.toString().substr(0, 10));
137
+ }
138
+ // console.log(
139
+ // `${payload.exp} < ${parseInt(
140
+ // new Date().getTime().toString().slice(0, -3)
141
+ // )}`
142
+ // );
135
143
 
136
- if (payload.exp < dateNow.getTime()) {
144
+ if (
145
+ payload.exp <
146
+ parseInt(new Date().getTime().toString().slice(0, -3))
147
+ ) {
137
148
  isExpiredToken = true;
138
149
  }
150
+
139
151
  if (payload.sub === R_USER && isExpiredToken === false) {
140
152
  const chk = await check(req.headers.authorization);
141
153
  // console.log(chk);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilesoft/ags_authrest2",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "This version has been deprecated",
5
5
  "main": "index.js",
6
6
  "scripts": {