Function oauth_refresh

Source
pub async fn oauth_refresh(
    http_client: &Client,
    oauth_client: &OAuthClient,
    dpop_key_data: &KeyData,
    refresh_token: &str,
    document: &Document,
) -> Result<TokenResponse, OAuthClientError>
Expand description

Refreshes OAuth access tokens using a refresh token.

This function exchanges a refresh token for new access and refresh tokens. It handles DPoP proof generation and client assertion creation for secure token refresh operations according to AT Protocol OAuth requirements.

§Arguments

  • http_client - The HTTP client to use for making requests
  • oauth_client - The OAuth client configuration
  • dpop_key_data - The key data for creating DPoP proofs
  • refresh_token - The refresh token to exchange for new tokens
  • document - The identity document containing PDS endpoints

§Returns

A TokenResponse containing the new access token, refresh token, and metadata on success.

§Errors

Returns OAuthClientError if the token refresh fails or response parsing fails.