react-token-manager 1.0.8 → 1.1.0
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/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +1 -1
- package/src/core.ts +5 -1
package/dist/index.js
CHANGED
|
@@ -123,6 +123,8 @@ var TokenManager = class {
|
|
|
123
123
|
try {
|
|
124
124
|
const decoded = this.decode(tokenToCheck);
|
|
125
125
|
if (!decoded || !decoded.exp) return true;
|
|
126
|
+
console.log("decoded", decoded);
|
|
127
|
+
console.log("decoded exp", decoded.exp);
|
|
126
128
|
const now = Date.now();
|
|
127
129
|
const expTime = decoded.exp * 1e3;
|
|
128
130
|
return now >= expTime;
|
package/dist/index.mjs
CHANGED
|
@@ -85,6 +85,8 @@ var TokenManager = class {
|
|
|
85
85
|
try {
|
|
86
86
|
const decoded = this.decode(tokenToCheck);
|
|
87
87
|
if (!decoded || !decoded.exp) return true;
|
|
88
|
+
console.log("decoded", decoded);
|
|
89
|
+
console.log("decoded exp", decoded.exp);
|
|
88
90
|
const now = Date.now();
|
|
89
91
|
const expTime = decoded.exp * 1e3;
|
|
90
92
|
return now >= expTime;
|
package/package.json
CHANGED
package/src/core.ts
CHANGED
|
@@ -107,7 +107,7 @@ export class TokenManager {
|
|
|
107
107
|
*/
|
|
108
108
|
isExpired(token?: string): boolean {
|
|
109
109
|
// Use provided token, fallback to stored 'access_token'
|
|
110
|
-
const tokenToCheck = token ?? this.getOne('access_token')
|
|
110
|
+
const tokenToCheck = token ?? this.getOne('access_token');
|
|
111
111
|
|
|
112
112
|
// If no token, consider it expired
|
|
113
113
|
if (!tokenToCheck) return true
|
|
@@ -118,6 +118,10 @@ export class TokenManager {
|
|
|
118
118
|
|
|
119
119
|
// If decoding fails or exp is missing, token is expired
|
|
120
120
|
if (!decoded || !decoded.exp) return true
|
|
121
|
+
|
|
122
|
+
console.log('decoded', decoded);
|
|
123
|
+
console.log('decoded exp', decoded.exp);
|
|
124
|
+
|
|
121
125
|
|
|
122
126
|
// Compare current time with token expiry
|
|
123
127
|
const now = Date.now()
|