Fix: cache the token forever if there is no expire time e.g. dropbox
This commit is contained in:
parent
d4dcdf3efd
commit
626ebe6f3a
|
@ -72,10 +72,10 @@ const tokenManager = (() => {
|
|||
if (!obj[k.TOKEN]) {
|
||||
return authUser(name, k, interactive);
|
||||
}
|
||||
if (Date.now() < obj[k.EXPIRE]) {
|
||||
if (!obj[k.EXPIRE] || Date.now() < obj[k.EXPIRE]) {
|
||||
return obj[k.TOKEN];
|
||||
}
|
||||
if (obj[k.EXPIRE]) {
|
||||
if (obj[k.REFRESH]) {
|
||||
return refreshToken(name, k, obj)
|
||||
.catch(err => {
|
||||
if (err.code === 401) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user