Skip to content

Comments

feat: Add Auth0 audience support via OAuth authorization_params#6205

Open
ndonkoHenri wants to merge 7 commits intomainfrom
auth-audience
Open

feat: Add Auth0 audience support via OAuth authorization_params#6205
ndonkoHenri wants to merge 7 commits intomainfrom
auth-audience

Conversation

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Feb 23, 2026

Fix #3775

Summary by Sourcery

Add support for passing extra authorization parameters from OAuth providers through to authorization URL generation and wire Auth0 audience configuration into this mechanism.

New Features:

  • Allow OAuth providers to specify additional authorization query parameters via an authorization_params mapping.
  • Support configuring an optional Auth0 audience value that is sent as an audience parameter during the OAuth authorization request.

Enhancements:

  • Document OAuthProvider, AuthorizationService, and Auth0OAuthProvider arguments and behavior more thoroughly.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for supplying Auth0’s audience parameter during OAuth authorization by introducing a generic mechanism for passing extra authorization URL query parameters through OAuthProvider into AuthorizationService.

Changes:

  • Add audience: Optional[str] to Auth0OAuthProvider and pass it as an authorization query parameter.
  • Extend OAuthProvider with authorization_params to carry extra authorization URL query parameters.
  • Update AuthorizationService.get_authorization_data() to append provider-supplied query parameters when generating the authorization URL.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sdk/python/packages/flet/src/flet/auth/providers/auth0_oauth_provider.py Adds audience and forwards it via new authorization_params.
sdk/python/packages/flet/src/flet/auth/oauth_provider.py Introduces authorization_params field and documents it.
sdk/python/packages/flet/src/flet/auth/authorization_service.py Expands authorization URL generation to include authorization_params.
Comments suppressed due to low confidence (2)

sdk/python/packages/flet/src/flet/auth/authorization_service.py:106

  • authorization_params are expanded directly into prepare_request_uri(...). If a provider sets a key that collides with existing keyword args (e.g., scope, state, code_challenge, code_challenge_method, or even redirect_uri), Python will raise a TypeError for duplicate values. Consider filtering out/forbidding reserved keys (raising a clear ValueError) or merging in a way that cannot override required parameters.
            state=self.state,
            code_challenge=self.provider.code_challenge,
            code_challenge_method=self.provider.code_challenge_method,
            **self.provider.authorization_params,
        )

sdk/python/packages/flet/src/flet/auth/authorization_service.py:235

  • Docstring link target looks incorrect: [User][flet.auth.user.] previously referenced flet.auth.user.User. As written, this likely breaks the generated docs link; please restore the correct reference (e.g., flet.auth.user.User) or align with the project’s preferred linking style.
        Returns:
            A [`User`][flet.auth.user.] built from response payload and
                `provider.user_id_fn`.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 23, 2026

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1bea77b
Status: ✅  Deploy successful!
Preview URL: https://0edefc77.flet-docs.pages.dev
Branch Preview URL: https://auth-audience.flet-docs.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 24, 2026

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1bea77b
Status: ✅  Deploy successful!
Preview URL: https://d886de42.flet-examples.pages.dev
Branch Preview URL: https://auth-audience.flet-examples.pages.dev

View logs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Audience parameter to Auth0OAuthProvider

1 participant