Bug
Two issues in OAuth credential handling:
saveCredentials overwrites refresh tokens: Google's token refresh often returns only a new access_token (no refresh_token). The current code writes the new response verbatim, which drops the stored refresh_token to undefined. Next refresh then fails, forcing a full re-auth.
isExpired discards credentials that could silently refresh: credentials with a valid refresh_token are treated as unusable on expiry instead of letting the caller refresh the access token.
Impact
Users get kicked out to full OAuth re-auth periodically despite having a valid refresh token stored.
Proposal
saveCredentials (both encrypted and file-based paths): merge with existing stored refresh_token when the new payload lacks one
isExpired: keep credentials that have a refresh_token and let the caller refresh
- Tolerate missing credentials on delete (idempotent)
Related
Fix proposed in #21695 (closed per contribution policy).
Bug
Two issues in OAuth credential handling:
saveCredentialsoverwrites refresh tokens: Google's token refresh often returns only a newaccess_token(norefresh_token). The current code writes the new response verbatim, which drops the storedrefresh_tokentoundefined. Next refresh then fails, forcing a full re-auth.isExpireddiscards credentials that could silently refresh: credentials with a validrefresh_tokenare treated as unusable on expiry instead of letting the caller refresh the access token.Impact
Users get kicked out to full OAuth re-auth periodically despite having a valid refresh token stored.
Proposal
saveCredentials(both encrypted and file-based paths): merge with existing storedrefresh_tokenwhen the new payload lacks oneisExpired: keep credentials that have arefresh_tokenand let the caller refreshRelated
Fix proposed in #21695 (closed per contribution policy).