Closed BrianCollinss closed 2 years ago
Hello,
secure_server
()return a
reactiveValueswith a slot
user` containing username. Here an example on how to use it:
library(shiny)
library(shinymanager)
ui <- secure_app(fluidPage(
uiOutput(outputId = "hello", container = tags$h3),
verbatimTextOutput("auth_output")
))
server <- function(input, output, session) {
res_auth <- secure_server(
check_credentials = check_credentials(data.frame(
user = c("user1", "user2"),
password = c("pwd", "pwd"),
extra_info = c("info user1", "info user2")
))
)
output$hello <- renderUI({
paste("Hello", res_auth$user, "!")
})
output$auth_output <- renderPrint({
reactiveValuesToList(res_auth)
})
}
shinyApp(ui, server)
Victor
Hi Victor. Is there any way I can pass this variable to UI as a character string, instead of wrapping it in a text?
If you need to generate UI according to username it has to be server-side, in renderUI()
for example.
I have tried every way I could think of to get the username on the server side and change the UI based on the user role. But I cannot do that. Is there any easy way to get and store the username / password / role / etc when user inputs their username and password and log-in?