Skip to content

Commit

Permalink
fix: PublisherClient required credentials even when using the emulator
Browse files Browse the repository at this point in the history
Fixes #5973
  • Loading branch information
jskeet committed Feb 24, 2021
1 parent 4cadc6c commit a43730c
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,8 @@ private static async Task<PublisherClient> CreateMaybeAsync(TopicName topicName,
// Clone settings, just in case user modifies them and an await happens in this method
settings = settings?.Clone() ?? new Settings();
var clientCount = clientCreationSettings?.ClientCount ?? Environment.ProcessorCount;
var channelCredentials = clientCreationSettings?.Credentials;
// Use default credentials if none given.
if (channelCredentials == null)
{
var credentials = isAsync ?
(await GoogleCredential.GetApplicationDefaultAsync().ConfigureAwait(false)) :
GoogleCredential.GetApplicationDefault();
if (credentials.IsCreateScopedRequired)
{
credentials = credentials.CreateScoped(PublisherServiceApiClient.DefaultScopes);
}
channelCredentials = credentials.ToChannelCredentials();
}

// Create the channels and clients, and register shutdown functions for each channel
var endpoint = clientCreationSettings?.ServiceEndpoint ?? PublisherServiceApiClient.DefaultEndpoint;
var clients = new PublisherServiceApiClient[clientCount];
var shutdowns = new Func<Task>[clientCount];
for (int i = 0; i < clientCount; i++)
Expand Down

0 comments on commit a43730c

Please sign in to comment.