'askpass' works locally, but not in shinyapps.io

When one enters the words: "alpha," "beta," and "gamma," and the slider is in "5", a window created by 'askpass' should pop up asking for a password (which is "pwd") and open the tab "Two." This process works in my local machine but not in shinyapps.io.

Any idea?

Thanks

library(shiny)
library(shinyjs)
library(askpass)

ui = fluidPage(
  useShinyjs(),  
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId  = "words", label = "Word(s)",
                  choices  = c("alpha","beta","gamma"), 
                  selected = "alpha",
                  multiple = TRUE),
      sliderInput("sldr","Enter number",min=1,max=5,value=3),
    ),
    mainPanel(
      navbarPage(title = "", 
                 id = "tsp",
                 tabPanel("One"), 
                 tabPanel("Two"), 
                 tabPanel("Three"))
    ) # closes mainPanel
  ), # closes sidebarLayout 
  
)    # closes ui
server = function(input, output) {
  observeEvent(c(input$words,input$sldr), {
    
    if(length(input$words)==3){  
      if(("alpha" == input$words[1]) && 
         ("beta"  == input$words[2]) && 
         ("gamma" == input$words[3]) && 
         (input$sldr == 5)){
        
        if(askpass("Just do it")=="pwd"){showTab(inputId = "tsp", target = "Two")}
        
      }else{
        hideTab(inputId = "tsp", target = "Two")
      } # closes if ... long set of conditions
    }else{
      hideTab(inputId = "tsp", target = "Two")
    }
  })
} # closes server

shinyApp(ui, server)

According to my reading of askpass, it works in native situations, i.e., running locally on Windows/Mac/Linux, but it isn't clear whether that includes web browsers. You might consider asking the package author.

Interesting. First of all, thanks for your answer. What it makes it interesting is that I asked the author, and he sends me back to "Shiny developers." This is what he said,

You need to ask this to the Shiny developers. The 'askpass' function
checks the global R option 'askpass' so Shiny would need to set that
to some callback widget to make it work (In a similar way as RStudio
IDE sets this to call the built-in password prompt).

So, how does one sets up the 'global R option for 'askpass'?

Thanks

I spoke with one of the Shiny developers, and their response was:

This will never work with Shiny. askpass needs you to provide a function that asks the user for a password and blocks until you can return a result . That’ll inherently never work in Shiny, you can’t ask the browser for something and block on receiving the answer. So really, the question is not how to make askpass work with Shiny, but how to prompt for passwords, and respond to those prompts, in Shiny.

Ideally he could just add a passwordInput to his UI, this is much easier to do than to prompt the user inside a nested conditional. The latter is definitely doable, but requires a lot more fancy reactive (and ideally async) programming.

I hope that helps!