gpt4 book ai didi

angularjs - 客户端无权访问Firebase中的所需数据

转载 作者:行者123 更新时间:2023-12-03 12:07:44 26 4
gpt4 key购买 nike

我有一个页面在 Controller 内部调用addCheckin()方法。在 Controller 中,我尝试创建如下引用:

var ref = firebase.database().ref("users/" + $scope.whichuser + "/meetings/" +$scope.whichmeeting + "/checkins");
$scope.whichuser$scope.whichmeeting是我从另一条路线传递的 $routeParams
这是我的值机 Controller -
myApp.controller("CheckinsController",
['$scope','$rootScope','$firebaseArray','$routeParams','$firebaseObject',
function($scope,$rootScope,$firebaseArray,$routeParams,$firebaseObject){

$scope.whichuser = $routeParams.uid;
$scope.whichmeeting = $routeParams.mid;

var ref = firebase.database().ref("users/" + $scope.whichuser + "/meetings/" +$scope.whichmeeting + "/checkins");

$scope.addCheckin = function(){
var checkinInfo = $firebaseArray(ref);
var data={
firstname:$scope.firstname,
lastname:$scope.lastname,
email:$scope.email,
date:firebase.database.ServerValue.TIMESTAMP
}

checkinInfo.$add(data);
}

}]);/*controller*/

我在这里遇到两个错误-

错误1:
Error: permission_denied at /users/Vp2P1MqKm7ckXqV2Uy3OzTnn6bB3/meetings: Client doesn't have permission to access the desired data.
错误2:
Error: permission_denied at /users/Vp2P1MqKm7ckXqV2Uy3OzTnn6bB3/meetings/-KT5tqMYKXsFssmcRLm6/checkins: Client doesn't have permission to access the desired data.
这就是我想要达到的目标-

enter image description here

最佳答案

转到您应用的Firebase控制台

从侧面菜单中选择数据库->从上面的选项卡中选择规则->这样更新规则

{
"rules": {
".read": true,
".write": true
}
}

希望它能解决您的问题。谢谢 :)

关于angularjs - 客户端无权访问Firebase中的所需数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39850118/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com