Fix provider OAuth refresh token reuse

This commit is contained in:
fawney19
2026-04-28 02:00:35 +08:00
parent 639f26ed5d
commit 321f21ad49
2 changed files with 235 additions and 5 deletions

View File

@@ -355,11 +355,11 @@ impl LocalOAuthRefreshCoordinator {
_ => None,
};
let refresh_entry = if force_refresh {
None
} else {
cached_entry.as_ref()
};
// Forced refresh still needs the latest rotated refresh_token as input.
// Otherwise a second overlapping refresh can acquire the lock after the
// first one completes, then immediately retry with the stale token that
// came from the original transport snapshot.
let refresh_entry = cached_entry.as_ref();
let refresh_result = adapter.refresh(executor, transport, refresh_entry).await;
if let (Some(lock), Some(lease)) = (distributed_lock, distributed_lease.as_ref()) {
if let Err(err) = lock.release(lease).await {