Skip to content

feat(auth): add external_consent param to suppress misleading warning#3473

Merged
jlowin merged 2 commits intoPrefectHQ:mainfrom
mtthidoteu:fix/consent-warning-suppression
Mar 14, 2026
Merged

feat(auth): add external_consent param to suppress misleading warning#3473
jlowin merged 2 commits intoPrefectHQ:mainfrom
mtthidoteu:fix/consent-warning-suppression

Conversation

@mtthidoteu
Copy link
Copy Markdown
Contributor

@mtthidoteu mtthidoteu commented Mar 13, 2026

Summary

  • Adds external_consent: bool = False parameter to OAuthProxy.__init__
  • When require_authorization_consent=False and external_consent=True, emits an info-level log instead of the security warning
  • No behavioral change when external_consent is not set — existing warning is preserved

Motivation

When using OAuthProxy with require_authorization_consent=False because consent is handled by a custom external login page (pointed to via upstream_authorization_endpoint), the warning "Authorization consent screen disabled - only use for local development or testing" is misleading. Consent is being collected — just not by FastMCP's built-in screen.

Closes #3472

## Usage
external_consent=True, # suppresses misleading warning

Edit: new usage will be:

OAuthProxy(
    upstream_authorization_endpoint="https://myapp.com/oauth/authorize",
    upstream_token_endpoint="https://myapp.com/oauth/token",
    ...
    require_authorization_consent="external", 
)

@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. labels Mar 13, 2026
Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

It's a good outcome but the solution is complicated and introduces tightly coupled kwargs.

My suggestion is to type

require_authorization_consent: bool | Literal["external"] = True

so that users who want to indicate that it is required but handled externally can do so. Passing external would suppress the warning.

This also needs to be implemented as a forwarded keyword argument from every OAuthProxy subclass (otherwise, it can't be used) and documented.

It may be considerably simpler to add a note to the logged warning that says "if consent is handled externally by your IdP, this is expected" and avoid all the incremental complexity.

When set to "external", the built-in consent screen is skipped
(same as False) but no security warning is logged, since consent
is handled externally by the upstream IdP.

Forwarded through all OAuthProxy subclasses: GoogleProvider,
GitHubProvider, AzureProvider, DiscordProvider, WorkOSProvider,
OIDCProxy, Auth0Provider, AWSCognitoProvider, and OCIProvider.
@mtthidoteu mtthidoteu force-pushed the fix/consent-warning-suppression branch from 47597c0 to f073897 Compare March 14, 2026 13:02
@mtthidoteu mtthidoteu requested a review from jlowin March 14, 2026 13:07
Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

Thanks!

@jlowin jlowin merged commit 7235029 into PrefectHQ:main Mar 14, 2026
4 of 7 checks passed
@mtthidoteu mtthidoteu deleted the fix/consent-warning-suppression branch March 20, 2026 09:28
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuthProxy: allow suppressing consent warning when consent is handled externally

2 participants