It's too difficult to create a client with anything but application Credentials.
See original GitHub issueFor all our APIs, it should be simple to create a client with
- Default application credentials. (implicitly)
- A path to .json credentials.
- Explicitly request Compute Engine credentials.
For an example, see the CloudLibrary class in https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/master/auth/AuthSample/Program.cs.
In Pubsub, it was too difficult to create a client with a path to .json credentials:
public static PublisherClient CreatePublisherWithServiceCredentials(string jsonPath)
{
GoogleCredential googleCredential = null;
using (var jsonStream = new FileStream(jsonPath, FileMode.Open,
FileAccess.Read, FileShare.Read))
{
googleCredential = GoogleCredential.FromStream(jsonStream)
.CreateScoped(PublisherClient.DefaultScopes);
}
return PublisherClient.Create(new Channel(PublisherClient.DefaultEndpoint.Host, PublisherClient.DefaultEndpoint.Port, googleCredential.ToChannelCredentials()));
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:17 (3 by maintainers)
Top Results From Across the Web
How to protect client credentials in a desktop app?
This is a known issue with desktop applications. You need to ensure first of all that your client id and client secrete are...
Read more >Create client credential for Azure AD's App registration
I created a new ASP.NET Core MVC 6.0 web application >> and i define it to use Azure AD for authentication, as follow:-....
Read more >Set up Application Default Credentials | Authentication
Application Default Credentials. Set up Application Default Credentials · How Application Default Credentials works · Troubleshoot your ADC setup.
Read more >Abusing Azure Application Credentials to Attack Supply ...
Conclusion. Attacks that abuse application permissions by compromising the application's owner are very difficult to detect. Organizations creating multi-tenant ...
Read more >API authentication and authorization best practices
Client authentication is vastly different from user authentication. Clients are automated, so authenticating them on every request to the API is ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note: Google.Cloud.Datastore.V1 2.2.0-beta02 now includes a DatastoreClientBuilder and a DatastoreDbBuilder to show how this can be done more generally.
I’m working on getting scopeless credentials fixed for gRPC clients. #1580 helps track how widespread the problem is. @LindaLawton the good news is that it seems to work for PubSub, so at least there you wouldn’t have a problem.
I beginning to wonder whether a simple
CreateFromCredentialsFile(string file, FooSettings = null)
method is the simplest fix here. I assume that having a file is the most common situation here.