Packages

A small, transport-agnostic atproto client for Gleam: XRPC, identity, OAuth discovery, blobs, and repo CRUD.

Current section

Files

Jump to
atproto_client src atproto oauth metadata.gleam
Raw

src/atproto/oauth/metadata.gleam

//// atproto OAuth discovery: from a user's PDS, find the authorization server
//// and its endpoints. A thin sync wrapper over the shared effect kernel in
//// `atproto/oauth/core/metadata`; the `AuthServerMetadata` type is re-exported
//// from there.
import atproto/oauth/core/metadata as core
import atproto/oauth/runner
import atproto/xrpc.{type Client, type XrpcError}
pub type AuthServerMetadata =
core.AuthServerMetadata
pub fn fetch_protected_resource(
client: Client,
pds: String,
) -> Result(List(String), XrpcError) {
runner.run_readonly(core.fetch_protected_resource(pds), client)
}
pub fn fetch_authorization_server(
client: Client,
issuer: String,
) -> Result(AuthServerMetadata, XrpcError) {
runner.run_readonly(core.fetch_authorization_server(issuer), client)
}
/// Resolve a PDS to its authorization server's endpoints in one call.
pub fn discover(
client: Client,
pds: String,
) -> Result(AuthServerMetadata, XrpcError) {
runner.run_readonly(core.discover(pds), client)
}