flutter - 获取令牌失败
问题描述
尝试将一些数据提取到云 Firestore 数据库中,当我这样做时,我收到此错误Failed to get token: com.google.firebase.firestore.FirebaseFirestoreException: getToken aborted due to token change.
。
发布规范.yaml
cloud_firestore: ^0.9.7
firebase_auth: ^0.8.1+4
安卓/build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.1.0'
}
获取employee_information的方法:
static addEmployee(Map<String, dynamic> snapshot){
Firestore.instance.runTransaction((Transaction tx) async{
await tx.set(Firestore.instance.collection('employee').document(),snapshot);
});
}
如果您遇到这个问题,请告诉我,谢谢!
解决方案
对于错误 [FirestoreCallCredentials]:无法获取令牌:
- 转到https://console.cloud.google.com/ - 选择您的项目
- 选择 API&服务
- 选择凭证
- 并更新 API 密钥中的值
推荐阅读
- javascript - 将java日期转换为角度日期
- php - Woocommerce 用户注册发布请求
- c - 如何从内核驱动程序中断用户空间应用程序?
- .net - 如何在 C++/CLI 中获取指针的值?
- r - 我不明白的 complete.casses 与 which 和 is.na 之间的矛盾
- java - 没有活动事务,保存无效
- udp - 使 UDP 广播与 wifi 路由器一起工作
- git - git stash 退出 0 但没有创建 stash
- python - 在 Python 3 中使用动态 SQL 语句
- javascript - TypeError: 无法注册 ServiceWorker: 获取脚本时收到错误的 HTTP 响应代码 (404)