Skip to content

Support OAuth2 .well-known discovery endpoints #12

Description

@roborourke

Add support for the OAuth2 .well-known discovery endpoints, so clients can find our authorization and token URLs automatically instead of hard-coding them.

  • /.well-known/oauth-authorization-server — authorization server metadata (RFC 8414): issuer, authorization_endpoint, token_endpoint, supported grant types, response types, and PKCE methods.
  • /.well-known/oauth-protected-resource — protected resource metadata (RFC 9728): resource identifier and linked authorization servers.

humanmade/hm-rest-ability already has a working version of this at inc/oauth2-discovery.php. It hooks parse_request to serve both JSON documents, and already points at this plugin's own routes (oauth2/authorize, oauth2/access_token), so it should port across with only small changes:

  • Drop the MCP-specific bits (the WWW-Authenticate header added only for /mcp/ REST routes, and the Require Login exemption written for that plugin).
  • Keep the two hm_oauth2_discovery_metadata / hm_oauth2_protected_resource_metadata filters, so sites can adjust the metadata.
  • Add PHPUnit coverage (that repo has tests/phpunit/OAuth2DiscoveryTest.php as a reference).

This makes the plugin discoverable by OAuth2/OIDC clients and MCP clients without extra config.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions