tidyverse / googlesheets4

Google Spreadsheets R API (reboot of the googlesheets package)
https://googlesheets4.tidyverse.org
Other
360 stars 53 forks source link

`sheets_auth` does not exist - how to login with GitHub Actions non-interactive authentication? #245

Closed RickyEsclapon closed 2 years ago

RickyEsclapon commented 3 years ago

Hello! Really love the simplicity of googlesheets4, but having a very opposite experience when trying to setup some automation through GitHub Actions.

There should be safe and simpler ways to support this type of workflow. I have seen this solution referenced, but it's not safe as it requires the user to save a secret to the github repo: https://stackoverflow.com/questions/44980757/remote-server-authentication-to-read-googlesheets-from-r-script-not-using-servic/59910070#59910070

I've tried everything I could find for the past 2 days to do this safely, but the docs don't provide very much color. The docs here: https://googlesheets4.tidyverse.org/reference/sheets_auth.html reference the sheets_auth() function that don't exist. Was this moved to the gs4_auth() function?

Is there no way to login with a service account as a string rather than a .json file? Any recommendations around securely authenticating non-interactively with GitHub Actions using secrets? I've tried every example that is linked by users around httr::oauth_app and gargle and I can't get any of them to work.

Any clarity anyone could provide here would be very much appreciated 🙂

jennybc commented 2 years ago

These are the definitive guides and these methods are used heavily in googlesheets4, googledrive, bigrquery:

Any recommendations around securely authenticating non-interactively with GitHub Actions using secrets? I've tried every example that is linked by users around httr::oauth_app and gargle and I can't get any of them to work.

There's a contradiction here, as I gather you want to use a service account. And a service account token makes no use of an oauth app.

RickyEsclapon commented 2 years ago

Ok sounds good thanks, will keep playing around with gargle, thanks for response. Will add anything I figure out back in here as I go in case it's helpful for others in the future.

matthewdwood82 commented 1 year ago

The secret_*() functions in https://gargle.r-lib.org/articles/articles/managing-tokens-securely.html have become deprecated. Is there an updated how-to? Thanks!

jennybc commented 1 year ago

The secret_*() functions in https://gargle.r-lib.org/articles/articles/managing-tokens-securely.html have become deprecated. Is there an updated how-to? Thanks!

As the maintainer of gargle, this is news to me!

Can you elaborate more so we can figure out the disconnect?