我得到了错误
gettingdocuments.com.google.firebase.firestore.FirebaseFirestoreException:
PERMISSION_DENIED:缺少或权限不足。
对于下面关于else语句的代码
db.collection("users")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
s(document.getId() + " => " + document.getData());
}
} else {
s("Error getting documents."+ task.getException());
}
}
});
NPM I—save firebase @angular/fire
在app.module中确保你导入了
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
进口
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule,
在实时数据库规则中,确保你有
{
/* Visit rules. */
"rules": {
".read": true,
".write": true
}
}
在云壁炉规则确保你有
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
NPM I—save firebase @angular/fire
在app.module中确保你导入了
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
进口
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule,
在实时数据库规则中,确保你有
{
/* Visit rules. */
"rules": {
".read": true,
".write": true
}
}
在云壁炉规则确保你有
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}