【发布时间】:2019-01-23 05:30:58
【问题描述】:
$path = "firebase_auth.json";
$config = array(
"projectId" => "XXXX",
"keyFile" => json_decode(file_get_contents($path), true)
);
$firestore = new FirestoreClient($config);
$collectionReference = $firestore->collection('Channels');
$snapshot = $collectionReference->documents().get();
此代码的响应是
遇到未捕获的异常
类型:Google\Cloud\Core\Exception\ServiceException
消息:{ "message": "缺少或权限不足。", "code": 7, "status": "PERMISSION_DENIED", "details": [] }
文件名:/var/www/html/riglynx/vendor/google/cloud/Core/src/GrpcRequestWrapper.php
行号:263
【问题讨论】:
-
您似乎没有阅读
Channels的权限。见firebase.google.com/docs/firestore/security/get-started。最简单(但最少锁定)的版本位于该页面第二个示例的ALLOW ALL框中。
标签: javascript firebase google-cloud-firestore firebase-security