Function oauth_protected_resource

Source
pub async fn oauth_protected_resource(
    http_client: &Client,
    aip_server: &str,
) -> Result<OAuthProtectedResource, OAuthClientError>
Expand description

Fetches OAuth protected resource metadata from an AIP server.

This function retrieves the OAuth protected resource configuration from the well-known endpoint of an AT Protocol Identity Provider (AIP) server. The metadata includes information about the protected resource endpoints and capabilities.

§Arguments

  • http_client - The HTTP client to use for making the request
  • aip_server - The base URL of the AIP server (e.g., “https://example.com”)

§Returns

Returns the OAuth protected resource metadata on success, or an error if:

  • The HTTP request fails
  • The response cannot be parsed as valid OAuth protected resource metadata

§Example

use atproto_oauth_aip::resources::oauth_protected_resource;
let resource = oauth_protected_resource(&http_client, "https://bsky.social").await?;