Skip to content

Commit 166e0e1

Browse files
committed
Refactor token refresh error message to include access token lifetime and buffer period
1 parent 8161040 commit 166e0e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

authenticationhandler/tokenmanager.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ func (h *AuthTokenHandler) CheckAndRefreshAuthToken(apiHandler apihandler.APIHan
2525

2626
refreshAttempts++
2727
if refreshAttempts >= maxConsecutiveRefreshAttempts {
28-
return false, fmt.Errorf("exceeded maximum consecutive token refresh attempts (%d): token lifetime is likely too short", maxConsecutiveRefreshAttempts)
28+
return false, fmt.Errorf(
29+
"exceeded maximum consecutive token refresh attempts (%d): access token lifetime (%s) is likely too short compared to the buffer period (%s) configured for token refresh",
30+
maxConsecutiveRefreshAttempts,
31+
h.Expires.Sub(time.Now()).String(), // Access token lifetime
32+
tokenRefreshBufferPeriod.String(), // Configured buffer period
33+
)
2934
}
3035
}
3136

0 commit comments

Comments
 (0)