| auth0_logout_url {auth0} | R Documentation |
Generates logout URL from configuration file. This can be used inside a shiny app button to logout from the app.
auth0_logout_url(config_file = NULL, redirect_js = TRUE)
config_file |
Path to YAML configuration file. |
redirect_js |
include javascript code to redirect page? Defaults to |
To use this function successfully inside a shiny app, you may
want to install shinyjs package. See example
If you want to use a diferent configuration file you can set the auth0_config_file
option with: options(auth0_config_file = "path/to-file").
url string to logout, collapsed or not by javascript code.
library(shiny)
library(auth0)
library(shinyjs)
# simple UI with action button
# note that you must include shinyjs::useShinyjs() for this to work
ui <- fluidPage(shinyjs::useShinyjs(), actionButton("logout_auth0", "Logout"))
# server with one observer that logouts
server <- function(input, output, session) {
observeEvent(input$logout_auth0, {
# javascript code redirecting to correct url
js <- auth0_logout_url()
shinyjs::runjs(js)
})
}
shinyAuth0App(ui, server, config_file = config_file)