I was wondering if it was possible to protect a shiny application with shinymanager but with having the possibility to access the first tab of the app before entering username and password while the second and third tab are hidden ?
I would like a "connect" button to launch the shinymanager page and then display the other tabs.
Does someone know if it is doable or should I use my own authentification form (which means less secured...) ?
My attempt:
library(shiny)
library(shinymanager)
library(shinydashboard)
library(shinyWidgets)
library(shinythemes)
credentials <- data.frame(
  user = c("user1"),
  password = c("1"),
  stringsAsFactors = FALSE
)
# user interface
ui <- navbarPage(id="navbarid",
                 "TEST",  theme = shinytheme("cosmo"),
                 header = tagList(
                   useShinydashboard()),
                 tabPanel(
                   "Welcome", fluidRow(align = "center", 
                        column(6, offset=4,
                               box(title = "Authentification", background = "black", 
                                 fluidRow(column(6, align = "center", style='padding-top:20px;',
                                    actionButton(inputId = "connect", label = "Log in")),
                                          column(6, align = "center", style='padding-top:20px;',
                                    actionButton(inputId = "register", label = "Register here"))))))),
                 tabPanel("Tab2", verbatimTextOutput("label1")
                   ),
                 tabPanel("Tab3", verbatimTextOutput("label2")
                 ))
ui <- secure_app(ui)
server <- function(input, output, session) {
  
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )
  
  output$icon1 <- renderText(as.character(icon("sign-in-alt")))
  output$icon2 <- renderText(as.character(icon("users")))
  output$label1 <- renderText("First tab content here")
  output$label2 <- renderText("Second tab content here")
}
shinyApp(ui, server)
I tried to add
observeEvent(input$connect, {
  res_auth <- secure_server(
    check_credentials = check_credentials(credentials)
  )})
at the beginning of my server part but it didn't work !
 
                        
The following is a combination of my earlier answers here and here.
I'm using two separate R sessions - both hosting a shiny app. A parent shiny app with public contents is launched as usual. This app contains an
iframeto show the secured contents of the shiny app launched in a child process viacallr::r_bg.A current drawback of this approach is, that shinymanager's logout button can't be used, as it is clearing the query string (reloading the shiny session I guess), which is needed to determine which tab is accessed.
Please check the following: