From b6ecf6eb7e761fa378310c1f05ecd26a35ac343a Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Thu, 8 Dec 2022 19:56:09 +0000 Subject: [PATCH 1/3] feat: adds ability to provide redirect uri --- google_auth_oauthlib/flow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/google_auth_oauthlib/flow.py b/google_auth_oauthlib/flow.py index 17b24e7..656d286 100644 --- a/google_auth_oauthlib/flow.py +++ b/google_auth_oauthlib/flow.py @@ -389,6 +389,7 @@ def run_console( self, authorization_prompt_message=_DEFAULT_AUTH_PROMPT_MESSAGE, authorization_code_message=_DEFAULT_AUTH_CODE_MESSAGE, + redirect_uri=None, **kwargs ): """Run the flow using the console strategy. @@ -429,7 +430,10 @@ def run_console( DeprecationWarning, ) - self.redirect_uri = self._OOB_REDIRECT_URI + if redirect_uri: + self.redirect_uri = redirect_uri + else: + self.redirect_uri = self._OOB_REDIRECT_URI auth_url, _ = self.authorization_url(**kwargs) From 856202ab820c371d61d8a27604c0a33f00ee8580 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 6 Jan 2023 15:09:18 +0000 Subject: [PATCH 2/3] Provides link to documentation for highly constrained environments --- google_auth_oauthlib/flow.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/google_auth_oauthlib/flow.py b/google_auth_oauthlib/flow.py index 656d286..7f1c938 100644 --- a/google_auth_oauthlib/flow.py +++ b/google_auth_oauthlib/flow.py @@ -423,9 +423,13 @@ def run_console( """ kwargs.setdefault("prompt", "consent") warnings.warn( - "New clients will be unable to use `InstalledAppFlow.run_console` " - "starting on Feb 28, 2022. All clients will be unable to use this method starting on Oct 3, 2022. " - "Use `InstalledAppFlow.run_local_server` instead. For details on the OOB flow deprecation, " + "Due to changes in Google has put into place to make OAuth flows safer, users should use " + "`InstalledAppFlow.run_local_server` where possible. If your system is running in an highly " + "constrained development environment such that a local server solution will not work " + "you may be able to implement a solution using `.run_console()` by providing a Client ID and " + "Client Secret. For more details see the documentation on authenticating in a highly " + "constrained environment: #TODO add URL to the docs." + "For details on the OOB flow deprecation, " "see https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob", DeprecationWarning, ) From 91ff36254f7043bce995a4d30e284857be36b538 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Fri, 6 Jan 2023 15:13:31 +0000 Subject: [PATCH 3/3] Revises verbiage for spelling and grammar --- google_auth_oauthlib/flow.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/google_auth_oauthlib/flow.py b/google_auth_oauthlib/flow.py index 7f1c938..e2561cb 100644 --- a/google_auth_oauthlib/flow.py +++ b/google_auth_oauthlib/flow.py @@ -423,12 +423,12 @@ def run_console( """ kwargs.setdefault("prompt", "consent") warnings.warn( - "Due to changes in Google has put into place to make OAuth flows safer, users should use " - "`InstalledAppFlow.run_local_server` where possible. If your system is running in an highly " + "Due to changes Google has put into place to make OAuth flows safer, users should use " + "`InstalledAppFlow.run_local_server` where possible. If your system is running in a highly " "constrained development environment such that a local server solution will not work " "you may be able to implement a solution using `.run_console()` by providing a Client ID and " - "Client Secret. For more details see the documentation on authenticating in a highly " - "constrained environment: #TODO add URL to the docs." + "Client Secret. For details on how to configure your system to and on authenticating in a highly " + "constrained environment see the following documentation: #TODO add URL to the docs." "For details on the OOB flow deprecation, " "see https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob", DeprecationWarning,