From 2ef6b00581fb66a16bf5bf4d45f6bd520c51cb2f Mon Sep 17 00:00:00 2001 From: Khushi Kathuria Date: Mon, 13 Oct 2025 11:53:16 +0530 Subject: [PATCH] fix(client_library): External Authentication bug fix --- google/cloud/internal/unified_grpc_credentials.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/google/cloud/internal/unified_grpc_credentials.cc b/google/cloud/internal/unified_grpc_credentials.cc index b1c82e99f2586..ee8005dee59ec 100644 --- a/google/cloud/internal/unified_grpc_credentials.cc +++ b/google/cloud/internal/unified_grpc_credentials.cc @@ -121,10 +121,14 @@ std::shared_ptr CreateAuthenticationStrategy( grpc::SslCredentialsOptions ssl_options; auto cainfo = LoadCAInfo(options); if (cainfo) ssl_options.pem_root_certs = std::move(*cainfo); - result = std::make_unique( - grpc::CompositeChannelCredentials( - grpc::SslCredentials(ssl_options), - GrpcExternalAccountCredentials(cfg))); + auto call_creds = GrpcExternalAccountCredentials(cfg); + auto channel_creds = grpc::SslCredentials(ssl_options); + if (call_creds) { + result = std::make_unique( + grpc::CompositeChannelCredentials(channel_creds, call_creds)); + } else { + result = std::make_unique(channel_creds); + } } void visit(ApiKeyConfig const& cfg) override { result = std::make_unique(cfg.api_key());