datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
379 stars 79 forks source link

"Unsupported language" when reopening tab #190

Closed johnbaums closed 1 month ago

johnbaums commented 1 month ago

If a user signs in using secure_app and then closes the browser tab, reopening the tab crashes the app with error:

Warning: Error in : Unsupported language !
  49: stop
  48: lan()$set_language
  47: observe
  46: <observer>
   3: runApp
   2: print.shiny.appobj
   1: <Anonymous>

This can be reproduced with the example given at ?secure_app:

library(shiny)
library(shinymanager)

credentials <- data.frame(
  user = c("shiny", "shinymanager"),
  password = c("azerty", "12345"),
  stringsAsFactors = FALSE
)

ui <- fluidPage(
  tags$h2("My secure application"),
  verbatimTextOutput("auth_output")
)
ui <- secure_app(ui, choose_language = TRUE)

server <- function(input, output, session) {
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )
  output$auth_output <- renderPrint({
    reactiveValuesToList(res_auth)
  })
  observe({
    print(input$shinymanager_where)
    print(input$shinymanager_language)
  })
}
shinyApp(ui, server)

Sign in with e.g. shiny and azerty, then close the tab and reopen the tab (cmd/ctrl + shift + t), and see the R console for warning message.

Session info ``` r sessioninfo::session_info() ─ Session info ─────────────────────────── setting value version R version 4.3.2 (2023-10-31) os macOS Ventura 13.6.6 system x86_64, darwin20 ui X11 language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 date 2024-05-16 pandoc NA ─ Packages ──────────────────────────── package * version date (UTC) lib source askpass 1.2.0 2023-09-03 [1] CRAN (R 4.3.0) billboarder 0.4.1 2023-09-29 [1] CRAN (R 4.3.0) bit 4.0.5 2022-11-15 [1] CRAN (R 4.3.0) bit64 4.0.5 2020-08-30 [1] CRAN (R 4.3.0) blob 1.2.4 2023-03-17 [1] CRAN (R 4.3.0) bslib 0.7.0 2024-03-29 [1] CRAN (R 4.3.2) cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.0) cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.0) colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.0) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0) DBI 1.2.2 2024-02-16 [1] CRAN (R 4.3.2) digest 0.6.35 2024-03-11 [1] CRAN (R 4.3.2) dplyr 1.1.4 2023-11-17 [1] RSPM (R 4.3.0) DT 0.33 2024-04-04 [1] CRAN (R 4.3.2) fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.0) fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.3.3) fontawesome 0.5.2 2023-08-19 [1] CRAN (R 4.3.0) generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0) ggplot2 3.5.1 2024-04-23 [1] CRAN (R 4.3.2) glue 1.7.0 2024-01-09 [1] CRAN (R 4.3.0) gtable 0.3.5 2024-04-22 [1] CRAN (R 4.3.2) htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.3.2) htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.0) httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.3.2) jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.3.0) jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.3.0) later 1.3.2 2023-12-06 [1] CRAN (R 4.3.0) lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.0) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.0) mime 0.12 2021-09-28 [1] CRAN (R 4.3.0) munsell 0.5.1 2024-04-01 [1] CRAN (R 4.3.2) openssl 2.1.2 2024-04-21 [1] CRAN (R 4.3.2) pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0) promises 1.3.0 2024-04-05 [1] CRAN (R 4.3.2) R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.0) R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.3.2) R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.3.0) R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0) Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.3.0) rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.0) RSQLite 2.3.6 2024-03-31 [1] CRAN (R 4.3.2) sass 0.4.9 2024-03-15 [1] CRAN (R 4.3.2) scales 1.3.0 2023-11-28 [1] CRAN (R 4.3.0) scrypt 0.1.6 2023-01-29 [1] CRAN (R 4.3.0) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0) shiny * 1.8.1.1 2024-04-02 [1] CRAN (R 4.3.2) shinymanager * 1.0.510 2024-05-16 [1] Github (datastorm-open/shinymanager@4211d5d) tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.3.2) utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.0) vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.3.0) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0) yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.0) [1] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library ────────────────────────────── ```
bthieurmel commented 1 month ago

Hi,

Fix on github.

Thanks.