Function oauth_init

Source
pub async fn oauth_init(
    http_client: &Client,
    oauth_client: &OAuthClient,
    dpop_key_data: &KeyData,
    handle: &str,
    authorization_server: &AuthorizationServer,
    oauth_request_state: &OAuthRequestState,
) -> Result<ParResponse, OAuthClientError>
Expand description

Initiates the OAuth authorization flow by making a Pushed Authorization Request (PAR).

This function creates a PAR request to the authorization server with the necessary OAuth parameters, DPoP proof, and client assertion. It handles the complete setup for the AT Protocol OAuth flow including PKCE and DPoP security mechanisms.

§Arguments

  • http_client - The HTTP client to use for making requests
  • private_signing_key_data - The private key for signing client assertions
  • dpop_key_data - The key data for creating DPoP proofs
  • handle - The user’s handle for the login hint
  • authorization_server - The authorization server configuration
  • oauth_request_state - The OAuth state parameters for this request

§Returns

A ParResponse containing the request URI and expiration time on success.

§Errors

Returns OAuthClientError if the PAR request fails or response parsing fails.