-
Notifications
You must be signed in to change notification settings - Fork 4
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
update gee authentication process #905
Conversation
hi @12rambau , would you mind telling me what is the format of the {"client_id": "", "client_secret": "", "refresh_token": ""} In any case I think we will have to add the |
I have copied the authentication process from the proposal on gee-community/pytest-gee#24. |
Ok that's much more complicated than that. What they did should be forbidden and I already told them on multiple occasion. 2 main issues to overcome are:
Let me report here when I move forward with one of the items |
@dfguerrerom can you check a credential file from a user in SEPAL a copy/paste it here (anonymised) I want to check if the project is saved in the credentials or not with modern users. |
actually, yes, when an user, old or new, logs in using the SEPAL google authentication process, it will automatically save the project id selected on the UI in the credentials file, this file has the following structure: {
"access_token":"....",
"access_token_expiry_date":"...",
"project_id":"something"
} Note that SEPAL stores the project with the key |
ok perfect so that is exactly the same as in a service account token. I think we should rely on that. Without parameter it will try to reach the default credentials and read the project_id from the token |
I made a PR in this direction in |
@12rambau, note that as I mentioned before, SEPAL uses |
@cdanielw any reason why you are not relying on the default key generated by GEE ? |
To my understanding, the default project id used when ee.initialize() is called, without explicitly specifying project, will be the legacy project. That one will stop working (if it hasn't already). |
What I meant to say is that when an local user authenticates in |
I didn't know there was a way to set that up. We can look into conforming to that. |
I think it's pretty recent, at start it was only in service accounts but now it's available for all account type as you need to set up the project when Initializing GEE. |
As this lib need to remain compatible with vanilla environments, I could you align on GEE behaviour ? I would like not to code custom behaviour that would only work on SEPAL. |
I think that's something we (sepal) can change at some point. |
|
actually, the credentials stored in sepal are quite different to the ones you're expecting in https://github.com/gee-community/geetools/blob/47cb326c1a6bf4757756b3f10a89aece91a365ce/geetools/Initialize/__init__.py#L59, we have: {"access_token":"","access_token_expiry_date":,"project_id":""} but that's fine because we install our own fork that will authenticate using our custom credentials file. question, Is there a reason why are you instantiating the |
|
Could you add the 2 "authentication" path we talked about when I was in Rome ? I think PR should be validated so you can work on |
@12rambau This PR contains what we discussed in Rome... if I'm remember correctly, it will work with both service account or individual gee accounts since the project is saved in the credentials file (?). |
Perfect, can you lint it and let's see how the tests behave from the CI/CD side |
@12rambau, I think it fails because there is no a |
I added the appropriate parameters. Before checking "project" you need to check "poject_id" as it's the one set up in the service account profile keys. "project" is only existing in SEPAL. |
Actually that's how it is written, but first, it will try with the It fails because with the google service account you cannot authenticate using that private key, we'll have to use the method described here: https://developers.google.com/earth-engine/guides/service_account#use-a-service-account-with-a-private-key (which is the one you use in The |
I guess yes but then it becomes more and more convoluted ;-) |
haha it failed again. I don't really know what is the structure of the |
that is the one I store which a very default token from the latest GEE API version: {
"type": "service_account",
"project_id": "sepal-ui",
"private_key_id": "key_id",
"private_key": "a key",
"client_email": "a.fake@mail",
"client_id": "id",
"auth_uri": "a.fake.url",
"token_uri": "a.fake.url",
"auth_provider_x509_cert_url": "a.fake.url",
"client_x509_cert_url": "a.fake.url",
"universe_domain": "a.fake.domain"
} |
closed in favor of #915 |
can you remove the branch if it's not needed anymore ? |
I assume it will fail because the
EARTHENGINE_TOKEN
doesn't contain theproject_id
keyWIP