Fix recursion in token resilience logic (#72)

This commit is contained in:
2025-10-07 10:34:15 +01:00
committed by GitHub
parent c3f23cb99b
commit 79d34ea4c9
2 changed files with 233 additions and 1 deletions
+3 -1
View File
@@ -182,7 +182,9 @@ func (trm *TokenResilienceManager) ExecuteTokenRefresh(ctx context.Context, t *T
var err error
err = trm.ExecuteTokenOperation(ctx, "token_refresh", func() error {
result, err = t.getNewTokenWithRefreshToken(refreshToken)
// Call exchangeTokens directly to avoid recursion back to getNewTokenWithRefreshToken
// which would call ExecuteTokenRefresh again, causing infinite loop (issue #67)
result, err = t.exchangeTokens(ctx, "refresh_token", refreshToken, "", "")
return err
})