【问题标题】:DrEdit sample Access Not Configured ErrorDrEdit 示例访问未配置错误
【发布时间】:2013-09-25 01:19:17
【问题描述】:

我正在尝试使用 Google Drive API 和 Drive SDK 编写我的第一个应用程序。我正在尝试从谷歌驱动器打开文件。这是我的代码:

if(isset($_GET['state'])){
    $json = $_GET['state'];
    $obj = json_decode($json);
    $idTab = $obj->{'ids'};
    $id = $idTab[0];
    $file = printFile($service, $id);
}
    function printFile($service, $fileId) {
    try {
        $file = $service->files->get($fileId);
        return $file;
    } catch (Exception $e) {
        print 'Error: '.$e->getMessage();
        return null;
      }
}

function downloadFile($file) {

    $downloadUrl = $file->getDownloadUrl();
      if ($downloadUrl) {
        $request = new Google_HttpRequest($downloadUrl, 'GET', null, null);
        $httpRequest = Google_Client::$io->authenticatedRequest($request);
        if ($httpRequest->getResponseHttpCode() == 200) {
            return $httpRequest->getResponseBody();
          } else {
          // An error occurred.
          return null;
        }
    } else {
    // The file doesn't have any content stored on Drive.
    return null;
  }
    }

我已在 API 控制台中启用了 Google Drive API 和 Drive SDK。我已经设置了我的客户端 ID、电子邮件地址、Web 应用程序的客户端密码以及我的 API 密钥和允许的引用者(接受来自 HTTP 的请求)。我已经在 Google Drive SDK 中输入了所有必要的数据,例如客户端 ID、打开 URL。我的其他范围是:[https://www.googleapis.com/auth/userinfo.profile]、[https://www.googleapis.com/auth/drive.install]、[https://www.googleapis. com/auth/drive.file]、[https://www.googleapis.com/auth/drive]。

我已经在谷歌商店安装了我的应用程序,我正在尝试通过我的应用程序从我的驱动器中打开文件。我有以下错误:

{
 "error": {
  "errors": [
  {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured"
   }
  ],
  "code": 403,
"message": "Access Not Configured"
 }
} 

我正在寻找解决方案,但我找不到。没有什么帮助。那么请谁能帮我解决这个问题?

【问题讨论】:

    标签: php google-drive-api google-drive-realtime-api


    【解决方案1】:

    但我已开启 Drive SDK 和 Drive API 服务,但仍然出现错误。在您向我展示的帖子中,解决方案是打开 Drive SDK 和 Drive API 服务。就我而言,这不是解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-16
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2014-01-27
      • 2014-01-24
      • 1970-01-01
      相关资源
      最近更新 更多