- 
                Notifications
    You must be signed in to change notification settings 
- Fork 49
Description
Dear Creators,
First of all thank you to have develop this amazing package.
I have a virtual machine set up to be able to access google earth engine using the rgee package
Before to start the authentication with google earth engine i would like to authenticate me by using the googledrive R package, because i will store all the data inside of it.
when I run the code manually it works perfectly but when I run a cron jobs with the cronr package the code gives me the following error.
<error/rlang_error>
Error in `googledrive::drive_auth()`:
! Can't get Google credentials.
ℹ Are you running googledrive in a non-interactive session? Consider:
• Call `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>
while when I run the code manually this is the result
>     googledrive::drive_auth(email ="[email protected]")
trying `token_fetch()`
Trying `credentials_byo_oauth()` ...
Error caught by `token_fetch()`:
inherits(token, "Token2.0") is not TRUE
trying `credentials_service_account()`
Error caught by `token_fetch()`:
Argument 'txt' must be a JSON string, URL or file.
trying `credentials_external_account()`
aws.ec2metadata not installed; can't detect whether running on EC2 instance
trying `credentials_app_default()`
Trying `credentials_gce()` ...
✖ We don't seem to be on GCE.
trying `credentials_user_oauth2()`
attempt to access internal gargle data from: googledrive
Gargle2.0 initialize
adding "userinfo.email" scope
loading token from the cache
email: [email protected]
oauth client name: tidyverse-erato
oauth client name: web
oauth client id: 603366585132-frjlouoa3s2ono25d2l9ukvhlsrlnr7k.apps.googleusercontent.com
scopes: ...drive, ...userinfo.email
token(s) found in cache:
[email protected]
token we are looking for:
[email protected]
matching token found in the cache
>     rgee::ee_Initialize(drive=T, 
+                         user="[email protected]",
+                         auth_quiet = T)
── rgee 1.1.7 ─────────────────────────────────────────────────────────────────────────────── earthengine-api 0.1.364 ── 
 ✔ user: [email protected] 
 ✔ Google Drive credentials:Auto-refreshing stale OAuth token.
putting token into the cache:
/home/agronomofiorentini/.config/earthengine//[email protected]
 ✔ Google Drive credentials:  FOUND
 ✔ Initializing Google Earth Engine:  DONE!
 ✔ Earth Engine account: users/useremail
 ✔ Python Path: /usr/bin/python3 
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
How can i fix this?
this is the code that i am using to autheticate me
googledrive::drive_auth(email ="[email protected]")
rgee::ee_Initialize(drive=T, 
                     user="[email protected]",
                     auth_quiet = T)
This is my r session info
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS
Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] shiny_1.7.5
loaded via a namespace (and not attached):
 [1] gtable_0.3.3      bslib_0.5.1       ggplot2_3.4.3     raster_3.6-23     processx_3.8.2    gargle_1.5.1     
 [7] lattice_0.21-8    vctrs_0.6.3       tools_4.3.1       Lmoments_1.3-1    ps_1.7.5          generics_0.1.3   
[13] curl_5.0.1        goftest_1.2-3     tibble_3.2.1      fansi_1.0.4       blob_1.2.4        pkgconfig_2.0.3  
[19] Matrix_1.5-4.1    checkmate_2.2.0   lifecycle_1.0.3   SPEI_1.8.1        compiler_4.3.1    munsell_0.5.0    
[25] terra_1.7-39      fontawesome_0.5.1 codetools_0.2-19  httpuv_1.6.11     htmltools_0.5.6   sass_0.4.7       
[31] later_1.3.1       pillar_1.9.0      crayon_1.5.2      jquerylib_0.1.4   cronR_0.6.5       MASS_7.3-60      
[37] ellipsis_0.3.2    openssl_2.0.6     cachem_1.0.8      RPostgres_1.4.5   mime_0.12         tidyselect_1.2.0 
[43] digest_0.6.33     rgee_1.1.7        purrr_1.0.2       dplyr_1.1.2       fastmap_1.1.1     grid_4.3.1       
[49] colorspace_2.1-0  lmom_2.9          cli_3.6.1         magrittr_2.0.3    TLMoments_0.7.5.3 utf8_1.2.3       
[55] rappdirs_0.3.3    scales_1.2.1      promises_1.2.0.1  backports_1.4.1   sp_2.0-0          bit64_4.0.5      
[61] googledrive_2.1.1 lubridate_1.9.2   timechange_0.2.0  httr_1.4.6        bit_4.0.5         reticulate_1.31  
[67] askpass_1.1       zoo_1.8-12        png_0.1-8         hms_1.1.3         memoise_2.0.1     RPostgreSQL_0.7-5
[73] miniUI_0.1.1.1    rlang_1.1.1       lmomco_2.4.9      Rcpp_1.0.11       xtable_1.8-4      glue_1.6.2       
[79] DBI_1.1.3         reshape_0.8.9     rstudioapi_0.15.0 jsonlite_1.8.7    plyr_1.8.8        R6_2.5.1         
[85] shinyFiles_0.9.3  fs_1.6.3 
I have tried also to use the token and save it as RDS and load when the cron job start, but dind't work.
token<-gargle::credentials_user_oauth2(scopes, client = gargle::gargle_client())
If you need more information, i am here always available.
Thanks again