feat: Add Auth0 audience support via OAuth authorization_params#6205
Open
ndonkoHenri wants to merge 7 commits intomainfrom
Open
feat: Add Auth0 audience support via OAuth authorization_params#6205ndonkoHenri wants to merge 7 commits intomainfrom
audience support via OAuth authorization_params#6205ndonkoHenri wants to merge 7 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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]toAuth0OAuthProviderand pass it as an authorization query parameter. - Extend
OAuthProviderwithauthorization_paramsto 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_paramsare expanded directly intoprepare_request_uri(...). If a provider sets a key that collides with existing keyword args (e.g.,scope,state,code_challenge,code_challenge_method, or evenredirect_uri), Python will raise aTypeErrorfor duplicate values. Consider filtering out/forbidding reserved keys (raising a clearValueError) 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 referencedflet.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.
Deploying flet-docs with
|
| Latest commit: |
1bea77b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0edefc77.flet-docs.pages.dev |
| Branch Preview URL: | https://auth-audience.flet-docs.pages.dev |
Deploying flet-examples with
|
| Latest commit: |
1bea77b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d886de42.flet-examples.pages.dev |
| Branch Preview URL: | https://auth-audience.flet-examples.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Enhancements: