Score:0

Creating a LoggingServiceV2Client with custom credentials

sa flag

I've been working on a C# desktop app that should be able to connect to a GCP account and pull/query the Logs there. I want this to be usable on computer, or to be able to access different accounts, so I don't want to rely on the Private key stored on the machine. Instead, I'm going to pass in an access token manually. This means that I cannot use the default "LoggingServiceV2Client.Create()" route to build the client. Instead, I'll need to use the "LoggingServiceV2ClientBuilder" class. However, I am having a lot of trouble setting the client up correctly, and have yet to get it to return a single successful query.

What I am using so far is:

           string cc = "super secret access token";

            var cred = GoogleCredential.FromAccessToken(cc);

            cred = cred.CreateScoped(LoggingServiceV2Client.DefaultScopes);


            var client = new LoggingServiceV2ClientBuilder { ChannelCredentials = cred.ToChannelCredentials()}.Build();
Pit avatar
dz flag
Pit
I am aware that you want to avoid “LoggingServiceV2Client.Create” but, have you seen this similar post about using [custom credentials with Stackdriver Logging API...](https://stackoverflow.com/questions/53175386/using-custom-credentials-with-stackdriver-logging-api-c-sharp-client-library). Please also have a look, [How do I ask a good question](https://stackoverflow.com/help/how-to-ask) in order to improve your question because it lacks some information.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.