【问题标题】:Google & Oauthlib - Scope has changed with InstalledAppFlowGoogle 和 Oauthlib - InstalledAppFlow 改变了范围
【发布时间】:2021-09-20 02:57:49
【问题描述】:

我有以下代码:

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,但调用不同方法时会出现错误,因此答案不适用于我的情况。

找不到解决方法。

【问题讨论】:

    标签: python-3.x google-api google-oauth google-api-client google-api-python-client


    【解决方案1】:

    好的,错误消息非常简单:我基本上必须将已弃用的范围条目替换为新的条目,如错误消息中所示:

    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']
    

    【讨论】:

      猜你喜欢
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      • 1970-01-01
      相关资源
      最近更新 更多