Search code examples
roauthgoogle-oauthgoogle-sheets-apihttr

r googlesheets package Waiting for authentication in browser


I installed the googlesheets package and

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

The browser pop up in a blank website, it is not go to the google auth page.

Below is my 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   

I have checked my httr package is updated, so I have not idea where the problem is. please advice.

Thanks.


Solution

  • Per the R help for gs_auth(), this function is not typically called directly by end users. Instead, it is called by other functions in the googlesheets package when they need to authenticate with Google.

    Instead, if you try to get a list of worksheets from a Google account, it will ask you to authenticate with a Google account. For example:

     mySheetList <- gs_ls()
    

    ...will initiate a login sequence that asks you to cut & paste an authentication URL into your web browser. Subsequent steps generate a token that is pasted back into the R console to authenticate.

    Details including screen shots on how to authenticate Google Sheets may be found in the Working with Google Sheets section of my article Running R and RStudio on a Chromebook.

    Here is an R console log including sessionInfo() illustrating the packages and versions used.

    > 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    
    >