【问题标题】:Opening file from google drive always requests offline access从谷歌驱动器打开文件总是要求离线访问
【发布时间】:2014-02-04 16:03:11
【问题描述】:

我有一个 google drive 应用程序,它不请求离线访问,并且已经安装并由用户授权。如果应用程序自己请求授权,则没有问题。

但是,最近每次从 Google Drive UI 打开文件时,都会出现授权提示:

This app would like to:
Have offline access

确定此请求仍然意味着它会在下次打开文件时出现。我可以在 Google Drive 生成​​的 URL 中看到它请求“access_type:offline”。我在云控制台中看不到任何设置来控制这一点,这对用户来说非常混乱。如何预防?

我看到很多类似的问题,但不是这样:

How to disable offline OAuth2 access from Google Drive SDK initiated connections?

Second authorization with same scope and offline access_type has unexpected permission dialog

"This app would like to: Have offline access" when access_type=online

The App keeps asking for permission to "Have offline access", why?

【问题讨论】:

    标签: google-drive-api


    【解决方案1】:

    看来我找到了解决方案。 如果您不使用相同的 client_id 和 client_secret 执行 OAuth2 流程的第 2 步,此消息将继续出现。

    @app.route('/open')
    def drive_open_file():
        code = request.args.get('code')
        if code:
            credentials = credentials_from_code("client", "secret",
                                   "https://www.googleapis.com/auth/drive.file",
                                   code,
                                   redirect_uri="<WEBSITE>/open")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 2020-05-17
      • 2014-05-22
      相关资源
      最近更新 更多