MarkEdmondson1234 / googleAuthR

Google API Client Library for R. Easy authentication and help to build Google API R libraries with OAuth2. Shiny compatible.
https://code.markedmondson.me/googleAuthR
Other
175 stars 54 forks source link

Error in googleAuthUI("login") : could not find function "googleAuthUI" #221

Open selesnow opened 2 years ago

selesnow commented 2 years ago

What goes wrong

Hello,

I try to run minimal example from https://code.markedmondson.me/googleAnalyticsR/articles/shiny.html

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

## ui.R
library(googleAuthR)
library(googleAnalyticsR)
library(shiny)
library(highcharter)

ui <- shinyUI(
  fluidPage(
    googleAuthUI("login"),
    authDropdownUI("auth_menu"),
    highchartOutput("something")

  ))

## in server.R
server <- function(input, output, session){

  ## Get auth code from return URL
  token <- callModule(googleAuth, "login")

  ga_accounts <- reactive({
    req(token())

    with_shiny(ga_account_list, shiny_access_token = token())

  })

  selected_id <- callModule(authDropdown, "auth_menu", ga.table = ga_accounts)

  gadata <- reactive({

    req(selected_id())
    gaid <- selected_id()
    with_shiny(google_analytics_3,
      id = gaid,
      start="2015-08-01", end="2017-08-02", 
      metrics = c("sessions"), 
      dimensions = c("date"),
      shiny_access_token = token())
  })

  output$something <- renderHighchart({

    ## only trigger once authenticated
    req(gadata())

    gadata <- gadata()

    ## creates a line chart using highcharts
    hchart(gadata, "line" , hcaes(x = date, y = sessions))

  })

}

# Run the application 
shinyApp(ui = ui, server = server)

And i get error Error in googleAuthUI("login") : could not find function "googleAuthUI"

Session Info

Please run sessionInfo() so we can check what versions of packages you have installed

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251    LC_MONETARY=Russian_Russia.1251
[4] LC_NUMERIC=C                    LC_TIME=Russian_Russia.1251    

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

other attached packages:
[1] highcharter_0.9.4      shiny_1.7.2            googleAnalyticsR_1.0.1 googleAuthR_2.0.0.9000

loaded via a namespace (and not attached):
 [1] zoo_1.8-10                tidyselect_1.1.2          purrr_0.3.4               gargle_1.2.0             
 [5] lattice_0.20-45           vctrs_0.4.1               generics_0.1.3            usethis_2.1.6            
 [9] htmltools_0.5.3           yaml_2.3.5                utf8_1.2.2                rlang_1.0.4              
[13] later_1.3.0               pillar_1.8.0              glue_1.6.2                DBI_1.1.3                
[17] rappdirs_0.3.3            TTR_0.24.3                lifecycle_1.0.1           quantmod_0.4.20          
[21] stringr_1.4.1             measurementProtocol_0.1.0 htmlwidgets_1.5.4         memoise_2.0.1            
[25] fastmap_1.1.0             httpuv_1.6.5              curl_4.3.2                fansi_1.0.3              
[29] broom_1.0.0               xts_0.12.1                Rcpp_1.0.8.3              xtable_1.8-4             
[33] promises_1.2.0.1          backports_1.4.1           cachem_1.0.6              jsonlite_1.8.0           
[37] mime_0.12                 fs_1.5.2                  digest_0.6.29             stringi_1.7.8            
[41] rlist_0.4.6.2             dplyr_1.0.9               grid_4.2.1                cli_3.3.0                
[45] tools_4.2.1               magrittr_2.0.1            tibble_3.1.8              whisker_0.4              
[49] tidyr_1.2.0               pkgconfig_2.0.3           ellipsis_0.3.2            data.table_1.14.2        
[53] lubridate_1.8.0           assertthat_0.2.1          httr_1.4.4                rstudioapi_0.14          
[57] R6_2.5.1                  igraph_1.3.4              compiler_4.2.1           
MarkEdmondson1234 commented 2 years ago

It's probably deprecated - could I see your sessionInfo()?

MarkEdmondson1234 commented 2 years ago

Yes please see last release notes https://github.com/MarkEdmondson1234/googleAuthR/releases

selesnow commented 2 years ago

could I see your sessionInfo()?

Yes. i attached sessionInfo:

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251    LC_MONETARY=Russian_Russia.1251
[4] LC_NUMERIC=C                    LC_TIME=Russian_Russia.1251    

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

other attached packages:
[1] highcharter_0.9.4      shiny_1.7.2            googleAnalyticsR_1.0.1 googleAuthR_2.0.0.9000

loaded via a namespace (and not attached):
 [1] zoo_1.8-10                tidyselect_1.1.2          purrr_0.3.4               gargle_1.2.0             
 [5] lattice_0.20-45           vctrs_0.4.1               generics_0.1.3            usethis_2.1.6            
 [9] htmltools_0.5.3           yaml_2.3.5                utf8_1.2.2                rlang_1.0.4              
[13] later_1.3.0               pillar_1.8.0              glue_1.6.2                DBI_1.1.3                
[17] rappdirs_0.3.3            TTR_0.24.3                lifecycle_1.0.1           quantmod_0.4.20          
[21] stringr_1.4.1             measurementProtocol_0.1.0 htmlwidgets_1.5.4         memoise_2.0.1            
[25] fastmap_1.1.0             httpuv_1.6.5              curl_4.3.2                fansi_1.0.3              
[29] broom_1.0.0               xts_0.12.1                Rcpp_1.0.8.3              xtable_1.8-4             
[33] promises_1.2.0.1          backports_1.4.1           cachem_1.0.6              jsonlite_1.8.0           
[37] mime_0.12                 fs_1.5.2                  digest_0.6.29             stringi_1.7.8            
[41] rlist_0.4.6.2             dplyr_1.0.9               grid_4.2.1                cli_3.3.0                
[45] tools_4.2.1               magrittr_2.0.1            tibble_3.1.8              whisker_0.4              
[49] tidyr_1.2.0               pkgconfig_2.0.3           ellipsis_0.3.2            data.table_1.14.2        
[53] lubridate_1.8.0           assertthat_0.2.1          httr_1.4.4                rstudioapi_0.14          
[57] R6_2.5.1                  igraph_1.3.4              compiler_4.2.1          
selesnow commented 2 years ago

Could you update the minimal example ?

MarkEdmondson1234 commented 2 years ago

Yes its a documentation update that this flags up