From bdc2f6d0c0b502b5a3ef367f9f7ca8ae3dafacbf Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 8 Aug 2018 18:19:54 -0700 Subject: [PATCH] Hacky Credentials Fix --- .../java/com/google/cloud/firestore/FirestoreOptions.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreOptions.java b/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreOptions.java index ba79ee48c6ad..7eb23074a73b 100644 --- a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreOptions.java +++ b/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreOptions.java @@ -208,6 +208,14 @@ public Builder setTimestampsInSnapshotsEnabled(boolean value) { @Override @Nonnull public FirestoreOptions build() { + if (this.credentials == null && this.credentialsProvider != null) { + try { + this.setCredentials(credentialsProvider.getCredentials()); + } catch (IOException e) { + throw new RuntimeException("Failed to obtain credentials", e); + } + } + return new FirestoreOptions(this); } }