DrEdit 示例“未配置访问”错误


DrEdit sample Access Not Configured Error

我正在尝试使用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;
  }
    }

我已经在 Apis 控制台中启用了 Google Drive API 和 Drive SDK。我已经为Web应用程序设置了我的客户端ID,电子邮件地址,客户端密码以及我的API密钥和允许的引用(接受来自HTTP的请求)。我已经在谷歌云端硬盘SDK中输入了所有必要的数据,如客户端ID,打开网址。我的附加范围是:[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"
 }
} 

我正在寻找并寻找解决方案,但我找不到。无济于事。所以请有人帮我解决这个问题吗?

但是我已经打开了云端硬盘 SDK 和云端硬盘 API 服务,但仍然出现错误。在帖子中,您向我展示了解决方案是打开驱动器 SDK 和驱动器 API 服务。就我而言,这不是解决方案。