@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.
Files changed (2) hide show
  1. package/index.js +19 -13
  2. 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.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
+ 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
- if (
145
- payload.exp <
146
- parseInt(new Date().getTime().toString().slice(0, -3))
147
- ) {
148
- isExpiredToken = true;
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilesoft/ags_authrest2",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "This version has been deprecated",
5
5
  "main": "index.js",
6
6
  "scripts": {