【发布时间】:2020-11-01 09:18:01
【问题描述】:
我正在构建这个使用 Cloud Firestore 的应用程序。问题是firestore不工作。这是我正在使用的代码
Db.dart
class Db{
// collection reference
static final CollectionReference _collectionReference = Firestore.instance.collection("codes");
static Future addOrUpdateCode(String code , double lat , double long) async {
return await _collectionReference.document(code).setData({
'lat':lat,
'long':long
});
}
}
我在 pubspec.yaml 中添加了这一行
cloud_firestore: ^0.13.7
我收到这些错误
I/BiChannelGoogleApi(13145): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@b61eba8
W/Firestore(13145): (21.3.0) [FirestoreCallCredentials]: Failed to get token: com.google.firebase.FirebaseException: An internal error has occurred. [ yRequests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked.�
W/Firestore(13145): #type.googleapis.com/google.rpc.Helpq
W/Firestore(13145): o
W/Firestore(13145): Google developer console API keyKhttps://console.developers.google.com/project/280924879656/apiui/credential ].
I/BiChannelGoogleApi(13145): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@b61eba8
W/Firestore(13145): (21.3.0) [FirestoreCallCredentials]: Failed to get token: com.google.firebase.FirebaseException: An internal error has occurred. [ yRequests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked.�
W/Firestore(13145): #type.googleapis.com/google.rpc.Helpq
W/Firestore(13145): o
W/Firestore(13145): Google developer console API keyKhttps://console.developers.google.com/project/280924879656/apiui/credential ].
I/BiChannelGoogleApi(13145): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@b61eba8
在云控制台中启用了以下 API
通过电子邮件/密码注册也在 firebase 中启用
我正在使用这些规则
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
}
}
我相信这是足够的信息。感谢您的宝贵时间。
【问题讨论】:
标签: firebase flutter dart google-cloud-platform google-cloud-firestore