gmail api 不断更改本地主机地址 (python)
gmail api keeps changing the localhost address (python)
我按照说明在我的应用程序中使用了 gmail oauth api。
在 Authorized redirect URIs 注册 url 似乎不起作用,因为 localhost 似乎在每个 运行 中更改后的数字(请看图片)
问题是,当调用 Google 的 OAuth2 页面时,redirect_uri 一直设置为 http://localhost:/
image of the error
当我 运行 来自 https://developers.google.com/gmail/api/quickstart/python
的代码时出现此错误
在 quickstart.py 脚本的第 44 行,为服务器分配您将在凭据中使用的相同端口。
然后把语句改成
creds = flow.run_local_server(port=<your-credentials-port>)
参见 google_auth_oauthlib.flow 模块。
我按照说明在我的应用程序中使用了 gmail oauth api。
在 Authorized redirect URIs 注册 url 似乎不起作用,因为 localhost 似乎在每个 运行 中更改后的数字(请看图片)
问题是,当调用 Google 的 OAuth2 页面时,redirect_uri 一直设置为 http://localhost:/
image of the error
当我 运行 来自 https://developers.google.com/gmail/api/quickstart/python
的代码时出现此错误在 quickstart.py 脚本的第 44 行,为服务器分配您将在凭据中使用的相同端口。
然后把语句改成
creds = flow.run_local_server(port=<your-credentials-port>)
参见 google_auth_oauthlib.flow 模块。