From 4a4b82942d8879e79e21049b46377244010e5e02 Mon Sep 17 00:00:00 2001 From: Kirill Bulygin Date: Wed, 14 Dec 2022 12:06:01 +0500 Subject: [PATCH] Fix the sign of the `tokenExpireIn` correction Make sure that even in a minute, the token is not to expire. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8fe74a8..3f58375 100644 --- a/index.js +++ b/index.js @@ -104,7 +104,7 @@ class NalogAPI { * @returns {Promise(string)} */ async getToken () { - if (this.token && this.tokenExpireIn && new Date().getTime() - 60 * 1000 < new Date(this.tokenExpireIn).getTime()) { + if (this.token && this.tokenExpireIn && new Date().getTime() + 60 * 1000 < new Date(this.tokenExpireIn).getTime()) { return this.token }