未能获得令牌

时间:2019-07-09 15:02:59

标签: flutter dart google-cloud-firestore

尝试将某些数据提取到Cloud Firestore数据库中时,我收到此错误Failed to get token: com.google.firebase.firestore.FirebaseFirestoreException: getToken aborted due to token change.

pubspec.yaml

cloud_firestore: ^0.9.7
firebase_auth: ^0.8.1+4

android / 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);
    });
  }

如果您遇到此问题,请告诉我,谢谢!

1 个答案:

答案 0 :(得分:0)

对于错误[FirestoreCallCredentials]:无法获取令牌:

  1. 转到https://console.cloud.google.com/-选择您的项目
  2. 选择API和服务
  3. 选择凭据
  4. 并更新API密钥中的值