r googlesheets 包在浏览器中等待身份验证

r googlesheets package Waiting for authentication in browser

我安装了 googlesheets 包和

code:
gs_auth()
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort

浏览器弹出一个空白网站,没有进入google授权页面。

下面是我的 session_info():

R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1

Matrix products: default
BLAS: 

/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK:/Library/Frameworks/R.framework/Versions/3.4/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] googlesheets_0.2.2       Rcpp_0.12.14             ggplot2_2.2.1            
quantmod_0.4-11         
 [5] TTR_0.23-2               xts_0.10-0               zoo_1.8-0                
dplyr_0.7.4             
 [9] data.table_1.10.4-3      bindrcpp_0.2             
alphavantager_0.1.0.9000 devtools_1.13.4         

loaded via a namespace (and not attached):
 [1] cellranger_1.1.0 compiler_3.4.2   git2r_0.19.0     plyr_1.8.4       
bindr_0.1       
 [6] tools_3.4.2      digest_0.6.12    jsonlite_1.5     memoise_1.1.0    
tibble_1.3.4    
[11] gtable_0.2.0     lattice_0.20-35  pkgconfig_2.0.1  rlang_0.1.4      
curl_3.0        
[16] xml2_1.1.1       withr_2.1.0      httr_1.3.1       stringr_1.2.0    
knitr_1.17      
[21] hms_0.4.0        grid_3.4.2       glue_1.2.0       R6_2.2.2         
purrr_0.2.4     
[26] readr_1.1.1      magrittr_1.5     scales_0.5.0     
assertthat_0.2.0 colorspace_1.3-2
[31] httpuv_1.3.5     stringi_1.1.6    openssl_0.9.9    lazyeval_0.2.1   
munsell_0.4.3   

我已经检查了我的 httr 包是否已更新,所以我不知道问题出在哪里。请指教

谢谢。

根据 gs_auth() 的 R 帮助,最终用户通常不会直接调用此函数。相反,当需要使用 Google.

进行身份验证时,googlesheets 包中的其他函数会调用它

相反,如果您尝试从 Google 帐户获取工作表列表,它会要求您使用 Google 帐户进行身份验证。例如:

 mySheetList <- gs_ls()

...将启动一个登录序列,要求您将身份验证 URL 剪切并粘贴到您的 Web 浏览器中。后续步骤会生成一个令牌,将其粘贴回 R 控制台以进行身份​​验证。

有关如何验证 Google 工作表的屏幕截图的详细信息可以在我的文章 运行 Chromebook 上的 R 和 RStudioWorking with Google Sheets 部分找到

这是一个 R 控制台日志,其中包括 sessionInfo() 说明所使用的包和版本。

> library(googlesheets)
> theSheetList <- gs_ls()
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
> theSheetList
# A tibble: 1 x 10
               sheet_title        author  perm version             updated sheet_key
                     <chr>         <chr> <chr>   <chr>              <dttm>     <chr>
1             PokemonStats    greskilabs    rw     new 2017-07-08 22:40:15 13rGxY7S…
 # ... with 4 more variables: ws_feed <chr>, alternate <chr>, self <chr>, alt_key <chr>
>
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] googlesheets_0.2.2

loaded via a namespace (and not attached):
[1] Rcpp_0.12.13     dplyr_0.7.4      assertthat_0.2.0 cellranger_1.1.0 R6_2.2.2         jsonlite_1.5     magrittr_1.5    
[8] httr_1.3.1       stringi_1.1.5    rlang_0.1.2      curl_3.0        bindrcpp_0.2     xml2_1.1.1       tools_3.4.2     
[15] stringr_1.2.0    glue_1.1.1       purrr_0.2.4      httpuv_1.3.5     yaml_2.1.14      compiler_3.4.2   pkgconfig_2.0.1 
[22] openssl_0.9.7    bindr_0.1        tibble_1.3.4    
> 

是chrome浏览器的问题,而不是任何R包,我在Mac的Firefox和safari中测试过,可以成功连接google张。