【问题标题】:UNAUTHENTICATED issue while connecting to Google Firestore连接到 Google Firestore 时出现未经验证的问题
【发布时间】:2017-10-07 23:48:03
【问题描述】:

我正在使用 Google Cloud Firestore Beta,并根据 google 提供的文档编写了一个非常简单的代码。我在执行它时收到一个未经身份验证的错误。代码如下,与文档中提供的一些sn-ps非常相似。

String keyPath = "mykeystore.json";
FirestoreOptions firestoreOptions = FirestoreOptions.getDefaultInstance().toBuilder().setProjectId("test-project-111").setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream(keyPath))).build();
Firestore db = firestoreOptions.getService();
DocumentReference docRef = db.collection("users").document("alovelace");
// Add document data  with id "alovelace" using a hashmap
Map<String, Object> data = new HashMap<>();
data.put("first", "Ada");
data.put("last", "Lovelace");
data.put("born", 1815);
//asynchronously write data
ApiFuture<WriteResult> result = docRef.set(data);
try 
{
    result.get();
} catch (InterruptedException e) 
{
    e.printStackTrace();
} catch (ExecutionException e) 
{
    e.printStackTrace();
}

I am getting the error at the "result.get()" line of the code. The error is as below:

[INFO] GCLOUD: java.util.concurrent.ExecutionException: com.google.api.gax.rpc.UnauthenticatedException: io.grpc.StatusRuntimeException: UNAUTHENTICATED

【问题讨论】:

标签: java firebase firebase-authentication google-cloud-firestore


【解决方案1】:

连接到 Google Firestore 时出现未经验证的问题

测试版

这是 Cloud Firestore 的测试版。此产品可能会以向后不兼容的方式进行更改,并且不受任何 SLA 或弃用政策的约束。

Cloud Firestore is currently in beta release。随着产品的成熟,对产品集成和平台的功能可用性和支持将继续改进。如需详细了解 Cloud Firestore 中的现有限制,请参阅限制和配额文档

验证您的 Firestore Api 密钥和 ID Cloud Firestore Security Rules

【讨论】:

    猜你喜欢
    • 2016-10-25
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    • 2014-05-16
    • 2021-03-13
    • 2019-06-28
    • 1970-01-01
    相关资源
    最近更新 更多