Я пытаюсь войти в блокнот Google Colab с помощью Oauth 2.0, но запущенная веб-страница входа в систему Google заканчивается в несуществующей сети (http://localhost:8090/?code=4/NAFDWUxkOxp3FIlB9I_vxFTFm-zjAx0XJpEspQ9dGozG-0L3ccthFD12FAhq_B5hLWTxDFuUg_SjC011V9jiLDw&scope=https://www.googleapis.com/auth/admin.directory.group.member%20https://www.googleapis.com/auth/admin.directory.group%20https://www.googleapis.com/auth/apps.groups.settings)
.
Возможно, ошибка связана с любым URL-адресом обратного вызова, но я не знаю, как это исправить.
Это код, который я использовал для входа в систему.
import os
os.environ['USE_NATIVE_IPYTHON_SYSTEM_COMMANDS'] = '1'
import httplib2
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
from oauth2client import tools
from google.colab import drive; drive.mount('/content/drive')
PATH_BASE = '/content/drive/My Drive/.../'
CLIENT_SECRET = PATH_BASE + 'client_secret_event.json'
SCOPES = [ "https://www.googleapis.com/auth/admin.directory.group", "https://www.googleapis.com/auth/admin.directory.group.member", "https://www.googleapis.com/auth/apps.groups.settings"]
STORAGE = Storage(PATH_BASE + 'credentials.storage')
flags = tools.argparser.parse_args([])
# Start the OAuth flow to retrieve credentials
def authorize_credentials():
# Fetch credentials from storage
credentials = STORAGE.get()
# If the credentials doesn't exist in the storage location then run the flow
if credentials is None or credentials.invalid:
flow = flow_from_clientsecrets(CLIENT_SECRET, scope=SCOPES)
http = httplib2.Http()
credentials = run_flow(flow, STORAGE, flags, http=http)
return credentials
credentials = authorize_credentials()
Есть идеи о том, почему это происходит?