mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 19:34:59 +00:00
fix: don't warn about expired OAuth tokens with valid refresh tokens (#4593)
OAuth credentials with a refresh token auto-renew on first API call, so the doctor should not warn about access token expiration when a refresh token is present. This avoids unnecessary "expired" warnings that prompt users to re-auth when no action is needed. Fixes #3032 Co-authored-by: Ayush Ojha <ayushozha@outlook.com>
This commit is contained in:
@@ -123,7 +123,16 @@ function buildProfileHealth(params: {
|
||||
};
|
||||
}
|
||||
|
||||
const { status, remainingMs } = resolveOAuthStatus(credential.expires, now, warnAfterMs);
|
||||
const hasRefreshToken = typeof credential.refresh === "string" && credential.refresh.length > 0;
|
||||
const { status: rawStatus, remainingMs } = resolveOAuthStatus(
|
||||
credential.expires,
|
||||
now,
|
||||
warnAfterMs,
|
||||
);
|
||||
// OAuth credentials with a valid refresh token auto-renew on first API call,
|
||||
// so don't warn about access token expiration.
|
||||
const status =
|
||||
hasRefreshToken && (rawStatus === "expired" || rawStatus === "expiring") ? "ok" : rawStatus;
|
||||
return {
|
||||
profileId,
|
||||
provider: credential.provider,
|
||||
|
||||
Reference in New Issue
Block a user