-
Notifications
You must be signed in to change notification settings - Fork 155
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
Creating Client from explicit credentials requires passing project #93
Comments
@offlinemark I am not able to reproduce, Found two ways to create client with explicit credentials which works for me. Sample code:
Another Example:
|
@HemangChothani I think was unclear; in my code the environment variable contains the contents of the json file. Not a path. When deploying on Heroku, in order to have the json file on the filesystem, I'd need to check the file into version control. I'd prefer to keep it in memory via environment variables. |
Seems like the issue I'm seeing is here. If there is no explicit project passed, the environment is the only place that is searched, although it is also plainly available in |
Also, fwiw none of your sample code works for me, even if the env did have a path (instead of a json strong). :/ You're certain that you don't have a valid |
@offlinemark Yes my bad , |
Here is the documentation of Credentials class to create explicit credentials .The class has no property like |
that is the base class. here's the actual class that is instantiated.
https://google-auth.readthedocs.io/en/latest/reference/google.oauth2.service_account.html#google.oauth2.service_account.Credentials.project_id
…On Fri, Apr 3, 2020 at 3:31 AM HemangChothani ***@***.***> wrote:
Seems like the issue I'm seeing is here. If there is no explicit project
passed, the environment is the only place that is searched, although it is
also plainly available in credentials.project_id.
Here is the documentation of Credentials
<https://google-auth.readthedocs.io/en/stable/reference/google.auth.credentials.html#google.auth.credentials.Credentials>
class to create explicit credentials .The class has no property like
project_id so won't search in credential.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAS2MGZ4YLA5ZB2UNCGT7CDRKWGELANCNFSM4LYD5MUA>
.
|
@offlinemark Ok, To fulfill this feature we need to pass 'credentials' here and also need to add method in Another point to set the priorities also a bit complex, like what if user pass project_id as keyword argument and also found in credentials and both are different, that might be create dilemma. To fulfill this, it's necessary to update these Need to ask responsible persons of those two libraries as it's not related to storage library. @frankyn Your comment, if any, would be greatly appreciated.Thanks in advance. |
@frankyn Could you comment on this? |
Hi folks, I filed an FR to see if this is something that we want to move forward on. I'm closing this issue because it's not only a Storage library request as it would update a common library shared other product libraries as well. |
Thanks for stopping by to let us know something could be better!
Environment details
python --version
3.7.6pip --version
20.0.2google-cloud-storage
version:pip show google-cloud-storage
1.26.0Steps to reproduce
Creating a Client using an explicit credentials object fails if the project parameter is not explicitly given. Since the project id should also be available from the credentials object, this should not be required of the caller.
The docs advertise an API where the project is not passed.
https://googleapis.dev/python/google-api-core/latest/auth.html#explicit-credentials
context: I'm trying to use GCS from heroku, where configuration is more easily done via env variables than the filesystem.
thanks!
Code example
output
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: