Module: AtprotoAuth::ServerMetadata

Defined in:
lib/atproto_auth/server_metadata.rb,
lib/atproto_auth/server_metadata/origin_url.rb,
lib/atproto_auth/server_metadata/resource_server.rb,
lib/atproto_auth/server_metadata/authorization_server.rb

Overview

Provides functionality for fetching and validating AT Protocol OAuth server metadata from both Resource Servers (PDS instances) and Authorization Servers (PDS/entryway).

The flow for resolving an account’s authorization server is:

  1. Start with PDS URL

  2. Fetch Resource Server metadata from /.well-known/oauth-protected-resource

  3. Get Authorization Server URL from authorization_servers array

  4. Fetch Authorization Server metadata from /.well-known/oauth-authorization-server

The module includes three main classes:

  • ResourceServer - Handles PDS metadata validation and authorization server discovery

  • AuthorizationServer - Handles authorization server metadata validation

  • OriginUrl - Validates URLs conform to AT Protocol’s “simple origin URL” requirements

Examples:

Resolving authorization server from PDS URL

resource_server = AtprotoAuth::::ResourceServer.from_url("https://pds.example.com")
auth_server_url = resource_server.authorization_servers.first
auth_server = AtprotoAuth::::AuthorizationServer.from_issuer(auth_server_url)

Defined Under Namespace

Classes: AuthorizationServer, OriginUrl, ResourceServer