Error in RStudio with google drive credentials and google earth engine

825 Views Asked by At

I am new to programming in R and am trying to execute a R code where I access the google drive and the google earth engine. However, two situations are happening: first on my personal laptop at home I run the code and it works perfectly and doesn't even open a browser to ask for access permission. While in the second case, when I use the remote desktop connection and access the company's computer, the code cannot get google credentials.

What could it be? will it be related to remote access or to the package version? follows data below:.

In my personal laptop:

> ## Initialize GEE ----
> ee_Initialize(email = gee_email, drive = TRUE)
-- rgee 1.0.9 ------------------------------------------------------------ earthengine-api 0.1.248 --
 √ email: [email protected] 
 √ Google Drive credentials:  FOUND
 √ Initializing Google Earth Engine:  DONE!
 √ Earth Engine user: users/rcode
-----------------------------------------------------------------------------------------------------

The same code in company's computer by remote desktop connection:

> ## Initialize GEE ----
> ee_Initialize(email = gee_email, drive = TRUE)
-- rgee 1.0.9 ------------------------------------------------------------------------------- earthengine-api 0.1.263 -- 
 √ email: [email protected] 
 √ Google Drive credentials:Erro: 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.
  * Read more in: https://gargle.r-lib.org/articles/non-interactive-auth.html

after of execute the commands:

options(gargle_quiet = FALSE)

googledrive::drive_auth("[email protected]")

> trying `token_fetch()`
> trying `credentials_service_account()`
> Error caught by `token_fetch()`:
  Argument 'txt' must be a JSON string, URL or file.
> trying `credentials_app_default()`
> trying `credentials_gce()`
> trying `credentials_byo_oauth()`
> Error caught by `token_fetch()`:
  inherits(token, "Token2.0") is not TRUE
> trying `credentials_user_oauth2()`
> Gargle2.0 initialize
> attempt to access internal gargle data from: googledrive
> adding 'userinfo.email' scope
> loading token from the cache
> no matching token in the cache
> initiating new token
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
> Error caught by `token_fetch()`:
  Failed to connect to accounts.google.com port 443: Timed out
Erro: 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.
  * Read more in: https://gargle.r-lib.org/articles/non-interactive-auth.html
1

There are 1 best solutions below

0
On

after many try I fixed the problem of the not opening browser removing and reinstalling the Rcpp package (ver. 1.0.7) now everything is working perfectly