pub async fn oauth_authorization_server(
http_client: &Client,
aip_server: &str,
) -> Result<AuthorizationServer, OAuthClientError>Expand description
Fetches OAuth authorization server metadata from an AIP server.
This function retrieves the OAuth authorization server configuration from the well-known endpoint of an AT Protocol Identity Provider (AIP) server. The metadata includes essential information such as:
- Authorization endpoint URL
- Token endpoint URL
- Pushed Authorization Request (PAR) endpoint URL
- Supported OAuth flows and capabilities
- JWKS (JSON Web Key Set) endpoint
§Arguments
http_client- The HTTP client to use for making the requestaip_server- The base URL of the AIP server (e.g., “https://example.com”)
§Returns
Returns the OAuth authorization server metadata on success, or an error if:
- The HTTP request fails
- The response cannot be parsed as valid OAuth authorization server metadata
§Example
use atproto_oauth_aip::resources::oauth_authorization_server;
let auth_server = oauth_authorization_server(&http_client, "https://bsky.social").await?;
println!("Authorization endpoint: {}", auth_server.authorization_endpoint);
println!("Token endpoint: {}", auth_server.token_endpoint);