1

Google Cloud Firestore Betaを使用しており、Googleが提供するドキュメントに基づいて非常に簡単なコードを書いています。私はそれを実行中にUNAUTHENTICATEDエラーが発生しています。コードは以下のとおりであり、ドキュメントに記載されている一部のコードと非常によく似ています。Google Firestoreに接続中にUNAUTHENTICATED問題が発生しました

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

+0

: –

+0

あなたのfirestore APIキー&IDを検証しますhttps://cloud.google.com/firestore/docs/solutions/search –

答えて

0

UNAUTHENTICATED問題に接続中GoogleのFirestore

ベータ

これはクラウドのベータリリースでありますファイアストア。この製品は、後方互換性のない方法で変更される可能性があり、SLAまたは非推奨ポリシーの対象にはなりません。

Cloud Firestore is currently in beta release。機能の可用性と製品統合とプラットフォームのサポートは、製品が成熟するにつれて改善し続けます。ここでは、完全なスタックトレースを共有クラウドFirestoreの既存の制限の詳細については、制限とクォータのマニュアルを参照してください

ORあなたのfirestore APIを検証し、キー&同上 Cloud Firestore Security Rules

関連する問題