From 52e62eba831d9cb456c8d41c4990113f7107d882 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Fri, 15 Nov 2019 14:32:45 +0100 Subject: [PATCH] bugfix: fix occassional invalid access token --- deploy/auth/util.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/auth/util.js b/deploy/auth/util.js index 2f225bc83..4236ccae6 100644 --- a/deploy/auth/util.js +++ b/deploy/auth/util.js @@ -38,7 +38,9 @@ const getPublicAccessToken = async () => { const decoded = jwtDecode(__publicAccessToken) const { exp } = decoded - if (!exp || isNaN(exp) || (exp * 1000 - Date.now() < 0)) { + + // refresh token if it is less than 30 minute expiring + if (!exp || isNaN(exp) || (exp * 1000 - Date.now() < 1e3 * 60 * 30 )) { await refreshToken() } -- GitLab