Password protect(ish) your Shiny app


I have trawled through various blogs looking for ways in which to password protect my Shiny apps. As a self described ‘coding moron’, I have struggled with some of the more complicated suggestions. So I set out to find the simplest, cleanest solution to my password protection woes, and here it is:

Disclaimer: This is not designed to give you high level password protection. Anyone with advanced computer skills can easily circumnavigate this protection and view your app/data.


ui <- fluidPage(

  # Application title
  titlePanel("My password protected Shiny App"),

  # Sidebar with user input elements
      passwordInput("pwIn", "Passcode")


    # Show a plot

server <- function(input, output) {

  output$distPlot <- renderPlot({

    #This is essentially your password code snippet. The below graoh will not run
    #unless you type the password; test
      need(input$pwIn=="test", "Please enter the passcode"

    #Generate data and draw plot


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


Author: Jamie Samson

I am a data scientist and passionate R user.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s