@agilesoft/ags_authrest2 1.0.3 → 1.0.4
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/index.js +19 -13
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -132,20 +132,26 @@ class Auth {
|
|
|
132
132
|
var isExpiredToken = false;
|
|
133
133
|
|
|
134
134
|
var dateNow = new Date();
|
|
135
|
-
if (payload.exp
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
if (payload.exp) {
|
|
136
|
+
if (payload.exp.toString().length > 10) {
|
|
137
|
+
payload.exp = parseInt(
|
|
138
|
+
payload.exp.toString().substr(0, 10)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
// console.log(
|
|
142
|
+
// `${payload.exp} < ${parseInt(
|
|
143
|
+
// new Date().getTime().toString().slice(0, -3)
|
|
144
|
+
// )}`
|
|
145
|
+
// );
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
if (
|
|
148
|
+
payload.exp <
|
|
149
|
+
parseInt(new Date().getTime().toString().slice(0, -3))
|
|
150
|
+
) {
|
|
151
|
+
isExpiredToken = true;
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
isExpiredToken = false;
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
if (payload.sub === R_USER && isExpiredToken === false) {
|