问题描述
我按照说明在我的应用程序中使用gmail oauth api。
在授权重定向URI上注册url似乎不起作用,因为本地主机后的数字似乎在每次运行中都会发生变化(请参见图片)
问题是,当调用Google的OAuth2页面时,redirect_uri一直设置为http:// localhost:/
当我从https://developers.google.com/gmail/api/quickstart/python运行代码时出现此错误
解决方法
在quickstart.py脚本的第44行中,将要在凭据中使用的端口分配给服务器。
然后将语句更改为
creds = flow.run_local_server(port=<your-credentials-port>)