您是否必须获取Google Chrome扩展程序中的云端硬盘权限才能调用云端硬盘API?

时间:2018-04-11 15:53:56

标签: google-chrome google-chrome-extension google-drive-api

My Extension在Manifest中调用了以下权限:

"oauth2": {
        "client_id": "425460661917-smaehlat7c66p1ns6t90ssj3jmlrrecm.apps.googleusercontent.com",
        "scopes": [
            "https://www.googleapis.com/auth/userinfo.email",
        "https://www.googleapis.com/auth/userinfo.profile",
            "https://www.googleapis.com/auth/drive.readonly"
      ]
  },

我只想在用户明确授予权限时使用Google云端硬盘。我此时只对文件元数据感兴趣,所以当用户指出它时,我使用Ajax调用来获取元数据:

$.ajax({
              type: "GET",
              beforeSend: function(request) {
                request.setRequestHeader("Authorization", "Bearer " + token);
              },
              url: "https://www.googleapis.com/drive/v3/files/" + googleFileID + "?fields=sharingUser",
              dataType: 'json',
              processData: true,
              success: function(gDocsMeta2) {// then code...

这很有效。

但是,每个用户都不想将我的应用与驱动器一起使用,但是(我认为)因为驱动器已经使用了驱动器。在清单中,可以理解的是,Chrome会定期弹出权限请求。

有没有办法获得更多情境许可?使用我现有的代码,当用户从驱动器请求数据时,会弹出一个权限...

任何帮助/方向赞赏。

0 个答案:

没有答案
相关问题