@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Function discoverAuthorizationRequirements

    • Walk the OAuth discovery chain starting from an agent URL. Returns AuthorizationRequirements when the agent demands OAuth, or null when a tools/list call succeeds without credentials.

      Strategy:

      1. POST tools/list to the agent with no Authorization header.
      2. If 401 + WWW-Authenticate: Bearer: parse the challenge.
      3. If the challenge carries resource_metadata=…: GET it and read resource + authorization_servers.
      4. For the first authorization_servers[0]: GET /.well-known/oauth-authorization-server and read authorization_endpoint, token_endpoint, registration_endpoint, scopes_supported.
      5. Return a structured record.

      Anything missing from the chain surfaces as undefined on the result — callers can still present a partial picture without re-probing.

      Parameters

      Returns Promise<AuthorizationRequirements | null>