From c6b3690e579eb460d0bd22eab07614ee2c9d645c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 10 Mar 2022 14:33:41 -0600 Subject: [PATCH 1/2] fix: avoid deprecated "out-of-band" authentication flow 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 --- docs/howto/authentication.rst | 8 +++++--- pandas_gbq/auth.py | 2 +- pandas_gbq/gbq.py | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/howto/authentication.rst b/docs/howto/authentication.rst index 877b1189..49a40825 100644 --- a/docs/howto/authentication.rst +++ b/docs/howto/authentication.rst @@ -156,9 +156,11 @@ credentials are not found. credentials = pydata_google_auth.get_user_credentials( SCOPES, - # Set auth_local_webserver to True to have a slightly more convienient - # authorization flow. Note, this doesn't work if you're running from a - # notebook on a remote sever, such as over SSH or with Google Colab. + # Note, this doesn't work if you're running from a notebook on a + # remote sever, such as over SSH or with Google Colab. In those cases, + # install the gcloud command line interface and authenticate with the + # `gcloud auth application-default login` command an the `--no-browser` + # option. auth_local_webserver=True, ) diff --git a/pandas_gbq/auth.py b/pandas_gbq/auth.py index 41ee4192..d59f75f3 100644 --- a/pandas_gbq/auth.py +++ b/pandas_gbq/auth.py @@ -28,7 +28,7 @@ def get_credentials( - private_key=None, project_id=None, reauth=False, auth_local_webserver=False + private_key=None, project_id=None, reauth=False, auth_local_webserver=True ): import pydata_google_auth diff --git a/pandas_gbq/gbq.py b/pandas_gbq/gbq.py index 6d06d3d6..41456d79 100644 --- a/pandas_gbq/gbq.py +++ b/pandas_gbq/gbq.py @@ -281,7 +281,7 @@ def __init__( project_id, reauth=False, private_key=None, - auth_local_webserver=False, + auth_local_webserver=True, dialect="standard", location=None, credentials=None, @@ -722,7 +722,7 @@ def read_gbq( index_col=None, col_order=None, reauth=False, - auth_local_webserver=False, + auth_local_webserver=True, dialect=None, location=None, configuration=None, @@ -762,7 +762,7 @@ def read_gbq( reauth : boolean, default False Force Google BigQuery to re-authenticate the user. This is useful if multiple accounts are used. - auth_local_webserver : bool, default False + auth_local_webserver : bool, default True Use the `local webserver flow `_ instead of the `console flow @@ -959,7 +959,7 @@ def to_gbq( chunksize=None, reauth=False, if_exists="fail", - auth_local_webserver=False, + auth_local_webserver=True, table_schema=None, location=None, progress_bar=True, @@ -1005,7 +1005,7 @@ def to_gbq( If table exists, drop it, recreate it, and insert data. ``'append'`` If table exists, insert data. Create if does not exist. - auth_local_webserver : bool, default False + auth_local_webserver : bool, default True Use the `local webserver flow `_ instead of the `console flow From ddb8195b7afe65985cdba7ae5acf1f97c471073c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Mon, 14 Mar 2022 11:30:39 -0500 Subject: [PATCH 2/2] Update docs/howto/authentication.rst Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> --- docs/howto/authentication.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/authentication.rst b/docs/howto/authentication.rst index 49a40825..029d5f38 100644 --- a/docs/howto/authentication.rst +++ b/docs/howto/authentication.rst @@ -159,7 +159,7 @@ credentials are not found. # Note, this doesn't work if you're running from a notebook on a # remote sever, such as over SSH or with Google Colab. In those cases, # install the gcloud command line interface and authenticate with the - # `gcloud auth application-default login` command an the `--no-browser` + # `gcloud auth application-default login` command and the `--no-browser` # option. auth_local_webserver=True, )