tidyverse / googledrive

Google Drive R API
https://googledrive.tidyverse.org/
Other
322 stars 47 forks source link

Error in dirve_auth() when trying to access gdrive using R cloud #414

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi, I am facing a problem in accessing google drive when I use Rcloud. I want to highlight that this does not happen when I use Rstudio on my laptop. The error I am getting is the following

`Error in `drive_auth()`:
! Can't get Google credentials
ℹ Are you running googledrive in a non-interactive session? Consider:
• `drive_deauth()` to prevent the attempt to get credentials
• Call `drive_auth()` directly with all necessary specifics
ℹ See gargle's "Non-interactive auth" vignette for more details:
ℹ <https://gargle.r-lib.org/articles/non-interactive-auth.html>
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
Error in `drive_auth()`:
! Can't get Google credentials
ℹ Are you running googledrive in a non-interactive session? Consider:
• `drive_deauth()` to prevent the attempt to get credentials
• Call `drive_auth()` directly with all necessary specifics
ℹ See gargle's "Non-interactive auth" vignette for more details:
ℹ <https://gargle.r-lib.org/articles/non-interactive-auth.html>
---` 

The access is blocked and I am forwarded to this page (see screenshot hereunder) Screenshot 2023-03-11 093400

My code is the following

###########################################################GDRIVE 
# Access GDRIVE

drive_auth(token = readRDS("grdive_access.rds"))

As I said before this works perfectly when I use Rstudio installed on my laptop and indeed Tidyverse API has access to my account

image

Can anyone help me sort this out?

I really need to access gdrive from Rcloud

Thanks in advance

jennybc commented 1 year ago

This is a result of an auth change (a method of auth being disabled) at Google.

The current version of the gargle package accounts for this change, so the solution is to update the gargle package:

install.packages("gargle")

ALSO VERY IMPORTANT: make sure to quit and restart any relevant R sessions, so they are using this newly installed version of gargle, not an older version currently loaded into memory. Things should "just work" again, although you will need to re-auth on affected platforms.

Anyone who wants to read more can see:

https://gargle.r-lib.org/news/index.html#partial-deprecation-out-of-band-oob-auth-flow-1-3-0

This is not necessary for typical users to understand, but if you want more details:

https://gargle.r-lib.org/articles/auth-from-web.html