-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide synchronous way of accessing application default credentials #652
Comments
Good point. In addition, I think that we do have a problem that we don't have standards. I like standards, but at the same time, I think that having only the Async version is fine (both async and non-async methods were written long time ago, later methods were written only for an async mode). What are your thoughts? Thanks! |
Well, I'm generally uncomfortable with forcing everything to be asynchronous. While |
I'm not sure that if you don't use asynchrony environment you will still choose The user shouldn't worry about calling |
While that's true for our implementation, it's not generally true of Glad you're generally on-board though. Will start having a look at how to best achieve it. |
This addresses issue googleapis#652. The "remarks" comment is deliberately off-putting, in that if you're in a situation where you *can* sensibly use the async call, you should do so - but as the rest of the client library allows synchronous calls, it would be odd not to do so for initialization. Alternatives to consider: - Put synchronous code in DefaultCredentialProvider (no obvious benefit, as we'd still need to await an HttpClient eventually) - Just document the "safety" of using the Result property in the async call
I think this is generally a good idea for the reasons mentioned above. Will possibly duplicate/resurrect #662. |
Currently we only have
GoogleCredentials.GetApplicationDefaultAsync
. That leaves callers unclear about how to fetch the default credentials in a synchronous piece of code without potentially deadlocking.It looks like all we'd need to provide is a synchronous form of
ComputeCredential.IsRunningOnComputeEngine()
... that's the only thing awaited inDefaultCredentialProvider.CreateDefaultCredentialAsync()
.The text was updated successfully, but these errors were encountered: