Skip to main content

refresh

Function refresh 

Source
pub async fn refresh(
    http: &Client,
    token_endpoint: &str,
    refresh_token: &str,
    client_id: &str,
    resource: Option<&str>,
) -> Result<TokenResponse, OAuthError>
Expand description

RFC 6749 §6 refresh-token grant — exchange a refresh_token for a fresh set.

The DevBoy AS rotates the refresh_token: the response carries a new one and the old is deactivated. Callers therefore MUST (1) persist the returned pair immediately and (2) serialize refreshes (single-flight) so two requests never race on the same — now dead — refresh_token. An invalid_grant error means the refresh_token is spent/revoked → the caller should re-run login.