首页 > 解决方案 > 获取令牌失败

问题描述

尝试将一些数据提取到云 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);
    });
  }

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

标签: flutterdartgoogle-cloud-firestore

解决方案


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

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

推荐阅读