Skip to content

Commit

Permalink
Merge pull request #1047 from burnash/bugfix/deprecate_console_flow
Browse files Browse the repository at this point in the history
Add warning about deprecated oauth flow
  • Loading branch information
lavigne958 authored May 13, 2022
2 parents fda5864 + f8b833e commit 3d1092f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gspread/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import json
import os
import warnings

from google.oauth2.credentials import Credentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
Expand Down Expand Up @@ -73,6 +74,18 @@ def console_flow(client_config, scopes):
Pass this function to ``flow`` parameter of :meth:`~gspread.oauth` to run
a console strategy.
"""
# The console flow has been disabled by google
# see: https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob
# now: warn the user about this
# next: remove this deprecated method
warnings.warn(
"The gspread.auth.console_flow flow won't succeed.\n"
"The OAuth out-of-band (OOB) flow is deprecated. "
"New clients will be unable to use this flow starting on Feb 28, 2022. "
"This flow will be deprecated for all clients on Oct 3, 2022. "
"Migrate to an alternative flow: gspread.auth.local_server_flow"
"see: https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob"
)
flow = InstalledAppFlow.from_client_config(client_config, scopes)
return flow.run_console()

Expand Down

0 comments on commit 3d1092f

Please sign in to comment.