Skip to content

Commit 4e2c2a5

Browse files
committed
fix: ApiKeyCredentials is passed to CallOptions
1 parent c0a5e62 commit 4e2c2a5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.google.api.gax.rpc.internal.Headers;
4848
import com.google.api.gax.tracing.ApiTracer;
4949
import com.google.api.gax.tracing.BaseApiTracer;
50+
import com.google.auth.ApiKeyCredentials;
5051
import com.google.auth.Credentials;
5152
import com.google.auth.Retryable;
5253
import com.google.common.base.Preconditions;
@@ -192,7 +193,9 @@ public GrpcCallContext nullToSelf(ApiCallContext inputContext) {
192193
public GrpcCallContext withCredentials(Credentials newCredentials) {
193194
Preconditions.checkNotNull(newCredentials);
194195
CallOptions newCallOptions = callOptions;
195-
if (channelCredentials == null || !(channelCredentials == newCredentials)) {
196+
if (channelCredentials == null
197+
|| newCredentials instanceof ApiKeyCredentials
198+
|| !(channelCredentials == newCredentials)) {
196199
newCallOptions = callOptions.withCallCredentials(MoreCallCredentials.from(newCredentials));
197200
}
198201
return new GrpcCallContext(

0 commit comments

Comments
 (0)