r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
668 stars 146 forks source link

Draft method for non-interactive authentication #336

Open bmaitner opened 1 year ago

bmaitner commented 1 year ago

Per #317 I've modified rgee so that it can work in a non-interactive setting using JSON format Google credentials. This seems to be working, as I've been able to use it in workflows for continuous integration via Github actions (see example here: https://github.com/AdamWilsonLab/emma_envdata ).

This PR is more of a "proof of concept". If you're happy with the general approach, I'll clean it up, fix the merge conflicts, etc. If not, I'm happy to take an alternative approach if you have options you prefer.

csaybar commented 1 year ago

Hello @bmaitner, thank you for opening this PR.

I very much appreciate your work on implementing non-interactive authentication using rgee. I have a few suggestions to consider:

  1. To avoid adding more arguments to the ee_Initialize function, I will suggest overloading the existing user, drive, and gcs parameters like this:
ee_Initialize(
    user="/EE_credential_path",
    drive="/JSON_token_path",
    gcs="/service_account_key_path"
)
  1. I recommend handling the authentication process within the ee_Initialize function itself, rather than adding the drive_cred_path argument to ee_as_stars or ee_as_sf. This way, all the necessary authentication steps can be performed in one place. To avoid conflicts and ensure a smooth transition (since the version of ee_Initialize in this PR is not the one currently used by the latest rgee version, and it seems that some arguments are duplicated, i.e. see user and email). I can start a new PR and work together to make this work!

Please let me know what you think about these suggestions. Once again, thank you for addressing this important topic and your contributions to the project.