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.js
CHANGED
|
@@ -2005,6 +2005,8 @@ function setDefaultAuthEngine(engine) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
2007
|
// src/application/token.ts
|
|
2008
|
+
var lastNoRefreshLog = 0;
|
|
2009
|
+
var NO_REFRESH_LOG_INTERVAL_MS = 5e3;
|
|
2008
2010
|
async function ensureValidAccessToken() {
|
|
2009
2011
|
const engine = getDefaultAuthEngine();
|
|
2010
2012
|
if (engine) {
|
|
@@ -2017,7 +2019,11 @@ async function ensureValidAccessToken() {
|
|
|
2017
2019
|
if (token && !isAccessTokenExpired()) return token;
|
|
2018
2020
|
const refreshToken = getRefreshToken();
|
|
2019
2021
|
if (!refreshToken) {
|
|
2020
|
-
|
|
2022
|
+
const now = Date.now();
|
|
2023
|
+
if (now - lastNoRefreshLog >= NO_REFRESH_LOG_INTERVAL_MS) {
|
|
2024
|
+
lastNoRefreshLog = now;
|
|
2025
|
+
logger.debug("No refresh token - cannot refresh; login required");
|
|
2026
|
+
}
|
|
2021
2027
|
throw new Error("No refresh token; login required");
|
|
2022
2028
|
}
|
|
2023
2029
|
return await refreshAccessToken();
|