auth on shinyapp.io

i have a rudimentary app hosted on shinyapps.io at the Standard subscription tier, which includes auth/ password protection.

here is some pseudo code; while it will work on a local machine, it really depends on shinyapps.io's auth machinery (esp the existence of session$user):

ui <- fluidPage(
  uiOutput("userPanel")
)

server <- function(input, output, session) {

  
  output$userPanel <- renderUI({
      HTML(paste0("Logged in as <code>", 
                  session$user, 
                  "</code>", 
                  "<a href=",
                  "'https://mycompany.shinyapps.io/my_site/__logout__/'",
                  ">logout</a>"))
  })
 
  
}

shinyApp(ui, server)

Question 1: when a user chooses to/ clicks to log out, how can I clear cookies such that they are forced to re-log in? In the current setup, a user can simply click the sign in button from the log in screen, due to the persistence of some cookie (I assume) which sort of defeats the purpose of having them sign out.

Question 2 (cosmetic): How can I specify a bit of css to have the log out code (ie, the uiOutput("userPanel") bit) appear in the upper right part of the browser, much like this old example from the shiny gallery?

Thank you in advance, anyone.

More information on this is in the documentation.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.