Skip to content

Add forward_resource flag to OAuthProxy#3711

Merged
jlowin merged 2 commits intomainfrom
forward-resource-flag
Mar 30, 2026
Merged

Add forward_resource flag to OAuthProxy#3711
jlowin merged 2 commits intomainfrom
forward-resource-flag

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Mar 30, 2026

Some IdPs (Auth0, Ping Federate) don't support the RFC 8707 resource parameter in authorize requests. Azure has a provider-level workaround, but there was no generic way to disable resource forwarding.

Adds forward_resource: bool = True to OAuthProxy, mirroring the existing forward_pkce pattern. Set it to False to suppress the resource parameter in upstream authorize URLs.

Auth0Provider(..., forward_resource=False)

Closes #2810.

@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. server Related to FastMCP server implementation or server-side functionality. labels Mar 30, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 702f9f06db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# PKCE configuration
forward_pkce: bool = True,
# Resource indicator (RFC 8707)
forward_resource: bool = True,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expose forward_resource on OIDC-based provider constructors

This change adds forward_resource only to OAuthProxy.__init__, but the OIDC entry points that users typically instantiate (OIDCProxy and wrappers like Auth0Provider) still have closed constructor signatures and init_kwargs that never accept/pass this flag (src/fastmcp/server/auth/oidc_proxy.py and src/fastmcp/server/auth/providers/auth0.py). As a result, Auth0Provider(..., forward_resource=False) raises a TypeError, and deployments using OIDC-based providers still cannot disable forwarding the resource parameter for IdPs that reject RFC 8707.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in the second commit (a4addca). All provider subclasses and OIDCProxy now accept and forward forward_resource.

@jlowin jlowin merged commit 665514e into main Mar 30, 2026
9 of 10 checks passed
@jlowin jlowin deleted the forward-resource-flag branch March 30, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to not forward the resource parameter in the OAuth provider

1 participant