diff --git a/plugins/auth-backend/src/service/router.ts b/plugins/auth-backend/src/service/router.ts index e04053c478..dddac82c2d 100644 --- a/plugins/auth-backend/src/service/router.ts +++ b/plugins/auth-backend/src/service/router.ts @@ -261,10 +261,15 @@ export function getDefaultBackstageTokenExpiryTime(config: Config) { const duration = readDurationFromConfig(config, { key: processingIntervalKey, }); - const seconds = Math.max( - 86400, - Math.round(durationToMilliseconds(duration) / 1000), - ); - return seconds; + const roundedDuration = Math.round(durationToMilliseconds(duration) / 1000); + + const minSeconds = Math.max(600, roundedDuration); + + const maxSeconds = Math.min(86400, roundedDuration); + + if (roundedDuration < minSeconds) { + return minSeconds + } + return maxSeconds; }