Skip to content

OAuth 2.1 server: support RFC 8707 Resource Indicators (resource parameter → aud claim) #2610

Open

Description

@emiel-os

Feature request

Support RFC 8707 Resource Indicators in the OAuth 2.1 authorization server: accept the resource parameter at the authorization and token endpoints, validate it, and bind the issued access token's aud claim to that resource URI.

Why

The MCP authorization spec requires resource-bound tokens: MCP clients send resource per RFC 8707, and strict native connectors (Claude Desktop and web, ChatGPT) reject or mis-scope tokens whose audience is not the MCP resource URL. Today the Supabase OAuth server ignores the resource parameter and stamps aud: "authenticated", so a Supabase-backed MCP resource server cannot satisfy the spec's audience-binding requirement with Supabase-issued tokens — the resource server has no way to influence the audience since only the token issuer can set it.

Current behavior

  • /oauth/authorize + token endpoint: resource parameter accepted-but-ignored.
  • Issued access tokens: aud: "authenticated" regardless of the requested resource.
  • RFC 9728 protected-resource metadata on the resource-server side points clients at Supabase as the authorization server, but the tokens that come back are not audience-bound to the resource.

Desired behavior

  • Accept resource at both the authorization and token endpoints (RFC 8707 semantics, including the multiple-resources / downscoping rules).
  • Validate the requested resource (e.g., against a per-client allowlist of registered resource URIs, or a project-level configuration).
  • Issue the access token with aud set to the granted resource URI (keeping "authenticated" as an additional audience would preserve backward compatibility with PostgREST/RLS consumers: aud: [resource, "authenticated"]).
  • Advertise support in the authorization-server metadata.

Impact

This unblocks the growing class of MCP servers that use Supabase Auth as their identity provider from having to stand up their own authorization server in front of Supabase purely to control the aud claim. With resource indicators supported, a Supabase-backed MCP server works with zero-config native connectors out of the box.

Happy to provide more detail on the MCP flow or test against a preview build — we run a production MCP resource server on Supabase Auth today and currently have to plan a wrapper AS solely for this gap.

Activity

  1. max2697 commented on Oct 3, 2026

    @max2697

    I’m seeing this too with a hosted Supabase OAuth 2.1 project. My MCP client included resource in the authorization request, but the issued token had aud: "authenticated". A refresh request explicitly including the same resource produced the same audience, so my MCP server rejected both tokens.
    Could you prioritize RFC 8707 resource-bound tokens through authorization, exchange, and refresh, or share the expected path to support them? I’d be happy to test a preview. Thanks!

  2. cadeskriacao commented on Oct 6, 2026

    @cadeskriacao

    Confirming on a hosted project (October 2026), and adding the security side of this. It goes beyond spec compliance.

    • /oauth/authorize accepts any absolute URI as resource. resource=https://evil.example/mcp goes straight to the consent page, and only a non-URI is refused ("resource must be an absolute URI").
    • A token issued with resource=https://evil.example/mcp on both authorize and token carries aud: "authenticated". No claim records the resource.

    Why it is a security issue, not only a compliance one. With dynamic registration on, a user can add a malicious MCP server whose protected-resource metadata names our project as its authorization server. Their own client (Claude or ChatGPT, with a legitimate registration and callback) gets a token "for" that server. Every token has the same audience, so that server can replay it against our MCP server and against PostgREST. The resource server cannot refuse it, and neither can the consent page: getAuthorizationDetails does not expose resource either.

    A smaller step that would already unblock projects: pass resource to the Custom Access Token hook, and expose it in getAuthorizationDetails. Projects could then set aud, or warn on the consent screen, while full RFC 8707 support lands.

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