Search code examples
rshinyshinymanager

Have to login twice with Shinymanager


I'm not sure what I'm doing wrong here, but even the most basic app from the documentation page, when I try to login into an app a second time I'm forced to enter the password twice. If I start a new file the first time I login the username/password works just fine, but then the next time I have to hit enter twice before it'll login. The first time it says "Invalid Username/password" I don't change anything just hit enter again and it logs in.

I'm losing my mind here so any help would be greatly appreciated!

Here is just the basic application from https://datastorm-open.github.io/shinymanager/

credentials <- data.frame(
  user = c("shiny", "shinymanager"), # mandatory
  password = c("azerty", "12345"), # mandatory
  start = c("2019-04-15"), # optinal (all others)
  expire = c(NA, "2019-12-31"),
  admin = c(FALSE, TRUE),
  comment = "Simple and secure authentification mechanism 
  for single ‘Shiny’ applications.",
  stringsAsFactors = FALSE
)

library(shiny)
library(shinymanager)

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

# Wrap your UI with secure_app
ui <- secure_app(ui)


server <- function(input, output, session) {
  
  # call the server part
  # check_credentials returns a function to authenticate users
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )
  
  output$auth_output <- renderPrint({
    reactiveValuesToList(res_auth)
  })
  
  # your classic server logic
  
}

shinyApp(ui, server)

I've tried moving things in my server/UI logic new files with basic apps


Solution

  • It appears this issue is fixed with the latest version (which is not yet on CRAN). See github issue Incorrect password when quickly pressing enter: https://github.com/datastorm-open/shinymanager/issues/195

    I used remotes::install_github('datastorm-open/shinymanager') to get the latest version and I'm no longer experiencing this issue.