Skip to content

Commit a0a6e80

Browse files
fix: use test credentials when connecting to the Emulator from the Firebase Admin SDK (#296)
1 parent 84f602e commit a0a6e80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreOptions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFunction;
2020
import com.google.api.core.InternalApi;
2121
import com.google.api.gax.core.CredentialsProvider;
22+
import com.google.api.gax.core.FixedCredentialsProvider;
2223
import com.google.api.gax.core.GoogleCredentialsProvider;
2324
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
2425
import com.google.api.gax.rpc.TransportChannelProvider;
@@ -255,7 +256,9 @@ public ManagedChannelBuilder apply(ManagedChannelBuilder input) {
255256
}
256257
})
257258
.build());
258-
this.setCredentials(new FakeCredentials());
259+
// Use a `CredentialProvider` to match the Firebase Admin SDK, which prevents the Admin SDK
260+
// from overwriting the Emulator credentials.
261+
this.setCredentialsProvider(FixedCredentialsProvider.create(new FakeCredentials()));
259262
}
260263

261264
return new FirestoreOptions(this);

0 commit comments

Comments
 (0)