Skip to content

Commit 4758e3a

Browse files
authored
fix: avoid deprecated "out-of-band" authentication flow (#500)
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 Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery-pandas/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent d8c3900 commit 4758e3a

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

docs/howto/authentication.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ credentials are not found.
156156
157157
credentials = pydata_google_auth.get_user_credentials(
158158
SCOPES,
159-
# Set auth_local_webserver to True to have a slightly more convienient
160-
# authorization flow. Note, this doesn't work if you're running from a
161-
# notebook on a remote sever, such as over SSH or with Google Colab.
159+
# Note, this doesn't work if you're running from a notebook on a
160+
# remote sever, such as over SSH or with Google Colab. In those cases,
161+
# install the gcloud command line interface and authenticate with the
162+
# `gcloud auth application-default login` command and the `--no-browser`
163+
# option.
162164
auth_local_webserver=True,
163165
)
164166

pandas_gbq/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
def get_credentials(
31-
private_key=None, project_id=None, reauth=False, auth_local_webserver=False
31+
private_key=None, project_id=None, reauth=False, auth_local_webserver=True
3232
):
3333
import pydata_google_auth
3434

pandas_gbq/gbq.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def __init__(
281281
project_id,
282282
reauth=False,
283283
private_key=None,
284-
auth_local_webserver=False,
284+
auth_local_webserver=True,
285285
dialect="standard",
286286
location=None,
287287
credentials=None,
@@ -722,7 +722,7 @@ def read_gbq(
722722
index_col=None,
723723
col_order=None,
724724
reauth=False,
725-
auth_local_webserver=False,
725+
auth_local_webserver=True,
726726
dialect=None,
727727
location=None,
728728
configuration=None,
@@ -762,7 +762,7 @@ def read_gbq(
762762
reauth : boolean, default False
763763
Force Google BigQuery to re-authenticate the user. This is useful
764764
if multiple accounts are used.
765-
auth_local_webserver : bool, default False
765+
auth_local_webserver : bool, default True
766766
Use the `local webserver flow
767767
<https://googleapis.dev/python/google-auth-oauthlib/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server>`_
768768
instead of the `console flow
@@ -959,7 +959,7 @@ def to_gbq(
959959
chunksize=None,
960960
reauth=False,
961961
if_exists="fail",
962-
auth_local_webserver=False,
962+
auth_local_webserver=True,
963963
table_schema=None,
964964
location=None,
965965
progress_bar=True,
@@ -1005,7 +1005,7 @@ def to_gbq(
10051005
If table exists, drop it, recreate it, and insert data.
10061006
``'append'``
10071007
If table exists, insert data. Create if does not exist.
1008-
auth_local_webserver : bool, default False
1008+
auth_local_webserver : bool, default True
10091009
Use the `local webserver flow
10101010
<https://googleapis.dev/python/google-auth-oauthlib/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server>`_
10111011
instead of the `console flow

0 commit comments

Comments
 (0)