微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Google 和 Oauthlib - 范围已随 InstalledAppFlow 发生变化

如何解决Google 和 Oauthlib - 范围已随 InstalledAppFlow 发生变化

我有以下代码

appflow = flow.InstalledAppFlow.from_client_secrets_file(
    "client_secret.json",scopes=scopes
)

appflow.run_local_server()

credentials = appflow.credentials

但它引发了这个错误

Warning: Scope has changed from "https://www.googleapis.com/auth/drive https://spreadsheets.google.com/Feeds https://www.googleapis.com/auth/gmail.compose" to "https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/gmail.compose".

我检查了 this question,但是在调用不同的方法时会出现错误,因此答案不适用于我的情况。

找不到解决方法

解决方法

好的,错误消息非常简单:我基本上必须用错误消息中指示的新的替换不推荐使用的范围条目:

原始scopes

scopes = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/gmail.compose']

scopes

scopes = ['https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/spreadsheets','https://www.googleapis.com/auth/gmail.compose']

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。