tenneo-auth-plugin 0.1.6 → 0.1.7
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 +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1998,6 +1998,8 @@ function setDefaultAuthEngine(engine) {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
|
|
2000
2000
|
// src/application/token.ts
|
|
2001
|
+
var lastNoRefreshLog = 0;
|
|
2002
|
+
var NO_REFRESH_LOG_INTERVAL_MS = 5e3;
|
|
2001
2003
|
async function ensureValidAccessToken() {
|
|
2002
2004
|
const engine = getDefaultAuthEngine();
|
|
2003
2005
|
if (engine) {
|
|
@@ -2010,7 +2012,11 @@ async function ensureValidAccessToken() {
|
|
|
2010
2012
|
if (token && !isAccessTokenExpired()) return token;
|
|
2011
2013
|
const refreshToken = getRefreshToken();
|
|
2012
2014
|
if (!refreshToken) {
|
|
2013
|
-
|
|
2015
|
+
const now = Date.now();
|
|
2016
|
+
if (now - lastNoRefreshLog >= NO_REFRESH_LOG_INTERVAL_MS) {
|
|
2017
|
+
lastNoRefreshLog = now;
|
|
2018
|
+
logger.debug("No refresh token - cannot refresh; login required");
|
|
2019
|
+
}
|
|
2014
2020
|
throw new Error("No refresh token; login required");
|
|
2015
2021
|
}
|
|
2016
2022
|
return await refreshAccessToken();
|