googledrive icon indicating copy to clipboard operation
googledrive copied to clipboard

drive_auth Error

Open ChrisPachulski opened this issue 2 years ago • 3 comments

All my scripts writing using drive_auth & gs4_auth on a mac began crashing yesterday. The functions still work fine on both linux and windows.

pacman::p_load(googlesheets4,googledrive)

options(httr_oob_default=TRUE) 
options(gargle_verbosity = "debug")
options(gargle_oauth_email = "[email protected]")
googledrive::drive_auth(email = "[email protected]",use_oob=TRUE)
googlesheets4::gs4_auth(email = "[email protected]",use_oob=TRUE)

Console:

trying `token_fetch()`
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()`
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
Error caught by `token_fetch()`:
ReadItem: unknown type 0, perhaps written by later version of R
Error in `googledrive::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.

sessionInfo()

R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] googledrive_2.0.0   googlesheets4_1.0.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.2  remotes_2.4.2     purrr_0.3.4       gargle_1.2.0.9002 colorspace_2.0-3  vctrs_0.4.1       generics_0.1.2   
 [8] testthat_3.1.4    usethis_2.1.5     utf8_1.2.2        rlang_1.0.2       pkgbuild_1.3.1    pillar_1.7.0      glue_1.6.2       
[15] withr_2.5.0       DBI_1.1.2         rappdirs_0.3.3    bit64_4.0.5       dbplyr_2.1.1      sessioninfo_1.2.2 lifecycle_1.0.1  
[22] munsell_0.5.0     cellranger_1.1.0  bigrquery_1.4.0   devtools_2.4.3    memoise_2.0.1     callr_3.7.0       fastmap_1.1.0    
[29] ps_1.7.0          curl_4.3.2        fansi_1.0.3       Rcpp_1.0.8.3      scales_1.2.0      cachem_1.0.6      desc_1.4.1       
[36] pkgload_1.2.4     jsonlite_1.8.0    fs_1.5.2          bit_4.0.4         brio_1.1.3        processx_3.5.3    dplyr_1.0.9      
[43] rprojroot_2.0.3   cli_3.3.0         tools_4.2.0       magrittr_2.0.3    tibble_3.1.6      pacman_0.5.1      crayon_1.5.1     
[50] pkgconfig_2.0.3   ellipsis_0.3.2    prettyunits_1.1.1 assertthat_0.2.1  httr_1.4.2        rstudioapi_0.13   R6_2.5.1         
[57] compiler_4.2.0   

Shifting all my scripts to linux vm, but would really like to be able to use mac again/figure out why these started crashing. Tried the usual drive_deauth() and auth, but it fails to accept any email, and doesn't provide the web UI either.

ChrisPachulski avatar Apr 28 '22 20:04 ChrisPachulski

Same problem just appeared for me. All was working as expected as of four days ago. Any progress on this @ChrisPachulski? Thank you!

sessionInfo()

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.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     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] gargle_1.2.0               zoo_1.8-8                  zipcodeR_0.1.0             xml2_1.3.2                 XML_3.99-0.3               writexl_1.3                custom_package_XXXXXXXXXXX tidyr_1.1.3                styler_1.3.2               stringr_1.4.0             
[11] scales_1.1.1               salesforcer_0.2.2          rstudioapi_0.13            rmarkdown_2.11             rlang_1.0.2                readxl_1.3.1               readr_1.4.0                RcppRoll_0.3.0             purrr_0.3.4                prettycode_1.1.0          
[21] openxlsx_4.2.5             microbenchmark_1.4-7       magick_2.3                 lubridate_1.7.10           knitr_1.34                 httr_1.4.2                 googlesheets4_1.0.0        googledrive_2.0.0          glue_1.6.2                 ggplot2_3.3.3             
[31] forcats_0.5.1              dplyr_1.0.7                digest_0.6.28              devtools_2.4.3             usethis_2.1.0             

loaded via a namespace (and not attached):
 [1] fs_1.5.0          rprojroot_1.3-2   tools_4.1.2       backports_1.1.7   utf8_1.2.2        R6_2.5.1          DBI_1.1.0         colorspace_1.4-1  withr_2.4.2       tidyselect_1.1.1  prettyunits_1.1.1 processx_3.5.2    curl_4.3          compiler_4.1.2    cli_3.3.0         desc_1.4.0       
[17] callr_3.7.0       askpass_1.1       rappdirs_0.3.3    base64enc_0.1-3   pkgconfig_2.0.3   htmltools_0.5.2   sessioninfo_1.1.1 fastmap_1.1.0     generics_0.1.0    jsonlite_1.7.2    zip_2.2.0         magrittr_2.0.1    rlist_0.4.6.1     Rcpp_1.0.7        munsell_0.5.0     fansi_0.5.0      
[33] lifecycle_1.0.1   stringi_1.7.6     pkgbuild_1.3.1    grid_4.1.2        crayon_1.4.1      lattice_0.20-45   hms_1.1.0         ps_1.6.0          pillar_1.6.3      pkgload_1.2.4     evaluate_0.14     data.table_1.14.2 remotes_2.4.2     vctrs_0.3.8       testthat_3.0.2    cellranger_1.1.0 
[49] gtable_0.3.0      assertthat_0.2.1  cachem_1.0.6      xfun_0.26         mime_0.11         tibble_3.1.4      memoise_2.0.1     ellipsis_0.3.2

arp3ggio avatar Jul 17 '22 19:07 arp3ggio

Nothing indicative of what went wrong...

I just ended up pushing everything to linux VM, did a complete reboot of my imac, reinstalling R, and pulling everything down from git and it worked after that. I'm sure there has to be an easier way but... that's how I handled

ChrisPachulski avatar Jul 17 '22 21:07 ChrisPachulski

Thanks for the follow up. Per https://github.com/tidyverse/googledrive/issues/389, I tried reinstalling openssl and then everything began working again as expected:

sudo su - -c "R -e \"install.packages(c('openssl'), repos='https://cran.rstudio.com/')\""

Or more commonly:
library(openssl)

arp3ggio avatar Jul 18 '22 21:07 arp3ggio

You need to install Rtools

renatocava avatar Nov 28 '22 18:11 renatocava