Skip to content
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

authentication-with-a default service-account isn't working #240

Open
lappazos opened this issue Nov 6, 2022 · 7 comments
Open

authentication-with-a default service-account isn't working #240

lappazos opened this issue Nov 6, 2022 · 7 comments
Labels
question Further information is requested triage

Comments

@lappazos
Copy link

lappazos commented Nov 6, 2022

regarding comment in PR #221, i tried https://docs.iterative.ai/PyDrive2/oauth/#authentication-with-a-service-account

i couldn't find where this function is implemented.
i tried to implement it by myself (copy pate), but the GCP environment couldn't find the "client_json_file_path": "service-secrets.json",

@lappazos
Copy link
Author

lappazos commented Nov 6, 2022

@shcheklein

@shcheklein
Copy link
Member

@lappazos please, no need to ping me directly and/or use my email. At least not immediately. We are getting notifications about the new issues.

i couldn't find where this function is implemented.

what function?
try to follow these steps to generate the secrets file - https://dvc.org/doc/user-guide/how-to/setup-google-drive-remote#using-service-accounts

@shcheklein shcheklein added question Further information is requested triage labels Nov 6, 2022
@lappazos
Copy link
Author

lappazos commented Nov 13, 2022

@shcheklein I don't think you understand. When you log in to a VM of GCP, you always use a service account. the service account credentials are available somehow in the machine (I'm not sure how, and that is the whole point of this request - automatic authentication using the VM service account credentials). many libraries can authenticate automatically when they are inside a GCP VM, saving the need in a JSON file. we don't want to create a JSON file, that is a potential security breach. BTW, at the moment I have no problem authenticating with JSON file - the whole point is avoiding that, using the VM Metadata credentials of the Service Account.

Back to your question, in the PR you suggested using https://docs.iterative.ai/PyDrive2/oauth/#authentication-with-a-service-account. This leads to a function called login_with_service_account, which I can't find in the library implementation.
As I mentioned above, I tried to implement it by myself (copy-paste), but the GCP environment couldn't find the "client_json_file_path": "service-secrets.json",

@shcheklein
Copy link
Member

Okay, I see. This duplicates this #187 and #179 ?

@lappazos @junp Do you know what is the mechanism behind the default service account? Is there a file in some location, ENV variable, etc? Is it the same as GoogleCredentials.get_application_default()?

Back to your question, in the PR you suggested using https://docs.iterative.ai/PyDrive2/oauth/#authentication-with-a-service-account. This leads to a function called login_with_service_account, which I can't find in the library implementation.

Could you give a link and / or more context?

@lappazos
Copy link
Author

Okay, I see. This duplicates this #187 and #179 ?

Yes, exactly

@lappazos @junp Do you know what is the mechanism behind the default service account? Is there a file in some location, ENV variable, etc? Is it the same as GoogleCredentials.get_application_default()?

Unfortunately, I don't know what is the mechanism

Back to your question, in the PR you suggested using https://docs.iterative.ai/PyDrive2/oauth/#authentication-with-a-service-account. This leads to a function called login_with_service_account, which I can't find in the library implementation.

Could you give a link and / or more context?

I'm not sure what you mean - you gave me the link to that function. it is nowhere to be found in the library, only in the documentation and didn't work when I implemented it by copying it to my python file since the file path wasn't correct.

@shcheklein
Copy link
Member

I'm not sure what you mean - you gave me the link to that function. it is nowhere to be found in the library, only in the documentation and didn't work when I implemented it by copying it to my python file since the file path wasn't correct.

okay, got it. Yes, for that workflow to work you need a file, or an ENV var, or something with the service account credentials. I would try to google and see how the default credentials are implemented - is a service account or not, are those saved in some file or not. Depending on that we either could modify the code a bit (I can help), or we'll need to wait for the PR to lend, or may be we'll have some way to fix the current implementation a bit to incorporate that flow.

@lappazos
Copy link
Author

@shcheklein Thanks, ill wait for your update

@shcheklein shcheklein changed the title authentication-with-a-service-account isn't working authentication-with-a default service-account isn't working Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested triage
Projects
None yet
Development

No branches or pull requests

2 participants