Skip to content

Commit

Permalink
fix: avoid deprecated "out-of-band" authentication flow (#55)
Browse files Browse the repository at this point in the history
The console-based copy-paste-a-token flow has been deprecated. See:
https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob
  • Loading branch information
tswast authored Mar 14, 2022
1 parent 311a200 commit 56a8676
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 9 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

.. _changelog-1.4.0:

1.4.0 / (TBD)
-------------

- Set ``use_local_webserver`` to ``True`` because of `Google's "out of band"
authentication flow deprecation
<https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.

.. _changelog-1.3.0:

1.3.0 / (2021-12-03)
Expand Down
9 changes: 7 additions & 2 deletions pydata_google_auth/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def login(args):
args.destination,
client_id=args.client_id,
client_secret=args.client_secret,
use_local_webserver=args.use_local_webserver,
use_local_webserver=not args.nouse_local_webserver,
)


Expand All @@ -80,7 +80,12 @@ def print_token(args):
login_parser.add_argument("--client_id", help=LOGIN_CLIENT_ID_HELP)
login_parser.add_argument("--client_secret", help=LOGIN_CLIENT_SECRET_HELP)
login_parser.add_argument(
"--use_local_webserver", action="store_true", help=LOGIN_USE_LOCAL_WEBSERVER_HELP
"--use_local_webserver",
action="store_true",
help="Ignored. Defaults to true. To disable, set --nouse_local_webserver option.",
)
login_parser.add_argument(
"--nouse_local_webserver", action="store_true", help=LOGIN_USE_LOCAL_WEBSERVER_HELP
)

print_token_parser = subparsers.add_parser(
Expand Down
6 changes: 3 additions & 3 deletions pydata_google_auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def default(
client_id=None,
client_secret=None,
credentials_cache=cache.READ_WRITE,
use_local_webserver=False,
use_local_webserver=True,
auth_local_webserver=None,
):
"""
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_user_credentials(
client_id=None,
client_secret=None,
credentials_cache=cache.READ_WRITE,
use_local_webserver=False,
use_local_webserver=True,
auth_local_webserver=None,
):
"""
Expand Down Expand Up @@ -279,7 +279,7 @@ def get_user_credentials(


def save_user_credentials(
scopes, path, client_id=None, client_secret=None, use_local_webserver=False
scopes, path, client_id=None, client_secret=None, use_local_webserver=True
):
"""
Gets user account credentials and saves them to a JSON file at ``path``.
Expand Down

0 comments on commit 56a8676

Please sign in to comment.