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

googleAuth module example not updating data after sign in #233

Open noahhaber opened 2 months ago

noahhaber commented 2 months ago

What goes wrong

When running the demo code for the shiny app authentication (exact copy of example code except client id), I am able to succesfully generate an oauth log in. However, after logging in, the data (name, email, etc) don't update.

Steps to reproduce the problem

Please note that if a reproduceable example that I can run is not available, then the likelihood of getting any bug fixed is low.

Run demo app deployed here: https://centerforopenscience.shinyapps.io/authentication_demo/

Expected output

After sign in, the name, email, and picture are updated

Actual output

No output

Before you run your code, please run:

options(googleAuthR.verbose=2) and copy-paste the console output here.
Check it doesn't include any sensitive info like auth tokens or accountIds - you can usually just edit those out manually and replace with say XXX


2024-07-05T17:18:47.130696+00:00 shinyapps[12279404]: Running on host: 9d1fe456eeb0
2024-07-05T17:18:47.134384+00:00 shinyapps[12279404]: Running as user: uid=10001(shiny) gid=10001(shiny) groups=10001(shiny)
2024-07-05T17:18:47.138081+00:00 shinyapps[12279404]: Connect version: 2024.05.0
2024-07-05T17:18:47.141690+00:00 shinyapps[12279404]: LANG: C.UTF-8
2024-07-05T17:18:47.145841+00:00 shinyapps[12279404]: Working directory: /srv/connect/apps/authentication_demo
2024-07-05T17:18:47.149955+00:00 shinyapps[12279404]: Using R 4.4.0
2024-07-05T17:18:47.153861+00:00 shinyapps[12279404]: R.home(): /opt/R/4.4.0/lib/R
2024-07-05T17:18:47.157671+00:00 shinyapps[12279404]: Content will use current R environment
2024-07-05T17:18:47.161725+00:00 shinyapps[12279404]: R_LIBS: (unset)
2024-07-05T17:18:47.165915+00:00 shinyapps[12279404]: .libPaths(): /usr/lib/R, /opt/R/4.4.0/lib/R/library
2024-07-05T17:18:47.169916+00:00 shinyapps[12279404]: shiny version: 1.8.1.1
2024-07-05T17:18:47.173655+00:00 shinyapps[12279404]: httpuv version: 1.6.15
2024-07-05T17:18:47.177527+00:00 shinyapps[12279404]: rmarkdown version: (none)
2024-07-05T17:18:47.181267+00:00 shinyapps[12279404]: knitr version: (none)
2024-07-05T17:18:47.185037+00:00 shinyapps[12279404]: jsonlite version: 1.8.8
2024-07-05T17:18:47.188979+00:00 shinyapps[12279404]: RJSONIO version: (none)
2024-07-05T17:18:47.192681+00:00 shinyapps[12279404]: htmltools version: 0.5.8.1
2024-07-05T17:18:47.196415+00:00 shinyapps[12279404]: reticulate version: (none)
2024-07-05T17:18:47.200214+00:00 shinyapps[12279404]: Using pandoc: /opt/connect/ext/pandoc/2.16
2024-07-05T17:18:48.038142+00:00 shinyapps[12279404]: 
2024-07-05T17:18:48.042850+00:00 shinyapps[12279404]: Starting R with process ID: '49'
2024-07-05T17:18:48.046850+00:00 shinyapps[12279404]: Shiny application starting ...
2024-07-05T17:18:48.050662+00:00 shinyapps[12279404]: 
2024-07-05T17:18:48.054485+00:00 shinyapps[12279404]: Listening on http://127.0.0.1:33007

Session Info

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

R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

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

time zone: America/New_York
tzcode source: internal

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

other attached packages:
 [1] shinydashboard_0.7.2 DT_0.33              googleAuthR_2.0.2    shinyjs_2.1.0        dplyr_1.1.4         
 [6] lubridate_1.9.3      shinythemes_1.2.0    stringr_1.5.1        googledrive_2.1.1    jsonlite_1.8.8      
[11] httr_1.4.7           htm2txt_2.2.2        rclipboard_0.2.1     googlesheets4_1.1.1  stringi_1.8.4       
[16] shiny_1.8.1.1       

loaded via a namespace (and not attached):
 [1] sass_0.4.9        utf8_1.2.4        generics_0.1.3    digest_0.6.35     magrittr_2.0.3    timechange_0.3.0 
 [7] fastmap_1.2.0     cellranger_1.1.0  promises_1.3.0    purrr_1.0.2       fansi_1.0.6       crosstalk_1.2.1  
[13] jquerylib_0.1.4   cli_3.6.2         rlang_1.1.3       crayon_1.5.2      yaml_2.3.8        withr_3.0.0      
[19] cachem_1.1.0      tools_4.4.0       gargle_1.5.2      memoise_2.0.1     httpuv_1.6.15     assertthat_0.2.1 
[25] curl_5.2.1        vctrs_0.6.5       R6_2.5.1          mime_0.12         lifecycle_1.0.4   htmlwidgets_1.6.4
[31] fs_1.6.4          fontawesome_0.5.2 pkgconfig_2.0.3   pillar_1.9.0      bslib_0.7.0       later_1.3.2      
[37] rsconnect_1.2.2   glue_1.7.0        Rcpp_1.0.12       tibble_3.2.1      tidyselect_1.2.1  rstudioapi_0.16.0
[43] xtable_1.8-4      htmltools_0.5.8.1 compiler_4.4.0    askpass_1.2.0     openssl_2.2.0   `

Exact code as deployed:

library(shiny)
library(googleAuthR)

options(googleAuthR.webapp.client_id = "128665549486-sshr4chi59a606k14gc82mkgtmls6tnd.apps.googleusercontent.com")
options(googleAuthR.verbose=2)

ui <- fluidPage(

  titlePanel("Sample Google Sign-In"),

  sidebarLayout(
    sidebarPanel(
      googleSignInUI("demo")
    ),

    mainPanel(
      with(tags, dl(dt("Name"), dd(textOutput("g_name")),
                    dt("Email"), dd(textOutput("g_email")),
                    dt("Image"), dd(uiOutput("g_image")) ))
    )
  )
)

server <- function(input, output, session) {

  sign_ins <- shiny::callModule(googleSignIn, "demo")

  output$g_name = renderText({ sign_ins()$name })
  output$g_email = renderText({ sign_ins()$email })
  output$g_image = renderUI({ img(src=sign_ins()$image) })

}

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