Skip to main content

refresh_if_expired

Function refresh_if_expired 

Source
pub async fn refresh_if_expired(provider: &str) -> Result<(), RefreshError>
Expand description

Refresh the stored OAuth credential for provider if it is expired or within 60 seconds of expiry. Concurrent calls coalesce on a per-provider OnceCell so the network round-trip runs at most once per cycle.

Returns Ok(()) immediately when the credential is unexpired or “never-expiring” (expires_at == 0) credentials; returns RefreshError::NotOAuth when the provider has no OAuth entry at all so the caller can distinguish “nothing to do” from “did a refresh”. Storage is read from the process-wide shared_auth_storage singleton.