-
Notifications
You must be signed in to change notification settings - Fork 25
Add prompt option to creating authorization urls #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mthadley
merged 3 commits into
main
from
allow-passing-prompt-parameter-for-um-authorization-url
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -325,6 +325,7 @@ def get_authorization_url( | |
| connection_id: Optional[str] = None, | ||
| organization_id: Optional[str] = None, | ||
| code_challenge: Optional[str] = None, | ||
| prompt: Optional[str] = None, | ||
| ) -> str: | ||
| """Generate an OAuth 2.0 authorization URL. | ||
|
|
||
|
|
@@ -349,6 +350,9 @@ def get_authorization_url( | |
| state (str): An encoded string passed to WorkOS that'd be preserved through the authentication workflow, passed | ||
| back as a query parameter. (Optional) | ||
| code_challenge (str): Code challenge is derived from the code verifier used for the PKCE flow. (Optional) | ||
| prompt (str): Used to specify whether the upstream provider should prompt the user for credentials or other | ||
| consent. Valid values depend on the provider. Currently only applies to provider values of 'GoogleOAuth', | ||
| 'MicrosoftOAuth', or 'GitHubOAuth'. (Optional) | ||
|
|
||
| Returns: | ||
| str: URL to redirect a User to to begin the OAuth workflow with WorkOS | ||
|
|
@@ -379,6 +383,8 @@ def get_authorization_url( | |
| if code_challenge: | ||
| params["code_challenge"] = code_challenge | ||
| params["code_challenge_method"] = "S256" | ||
| if prompt is not None: | ||
| params["prompt"] = prompt | ||
|
Comment on lines
+386
to
+387
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test for this new parameter? Looks like this PR is still in draft, so might be on the way. |
||
|
|
||
| return RequestHelper.build_url_with_query_params( | ||
| base_url=self._client_configuration.base_url, | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like Google OAuth, Microsoft OAuth, and GitHub OAuth all have a pretty limited set of values for
prompt. Could be nice to maintain a set of allowed values with a literal. Not required, though if we want to do it, would be good to do it now, otherwise it'd be a breaking change later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the values are meaningful to the downstream providers (not us), are not consistent across them (though somewhat overlap), and if any providers changed later would require us to update the SDK before new values could be passed, I'm leaning towards skipping validation in order to stay decoupled.
Not a bad idea! Just not sure it's worth it in this particular case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that makes sense!