I have shinyapps.io standard plan, i give access to users though their email id. https://www.shinyapps.io/
Requirements:- I want to write code that the access is removed permanently after certain time once they are successfully logged in.
App should be stopped for only one particular user whose time limit is over and should not affect other logged in users in anyways (who have logged in recently and their time limit is not over).
What I have done:-
I asked this question on rstudio community. https://community.rstudio.com/t/how-to-automatically-remove-access-permanently-to-shiny-app-after-fixed-time-once-they-are-logged-in/134564/2
Based on suggestion, i tried the below code,
library(shiny)
library(htmltools)
ui <- fluidPage(
h1('My Shiny app'),
p('You will be disconnected after 5 seconds...'),
tags$script(HTML(
"
document.addEventListener('DOMContentLoaded', (event) => {
setTimeout(() => {Shiny.onInputChange('disconnect', true)}, 5000)
} )
"
))
)
server <- function(input, output, session) {
observeEvent(input$disconnect, {
if (input$disconnect) shiny::stopApp()
})
}
shinyApp(ui, server)
Outcome:-
While the app closes when testing on Rstudio, but it just disconnect on browser, and if you refresh the website, you get access again.
Is there anyway that once login is successful first time, after certain time access is removed permanently?
Can anyone modify the code or show any example/link where it has been discussed earlier?
Will appreciate it so much.
Thanks