Create a Google login before your Shiny UI launches
A function that will turn your ui object into one that will look for Google authentication before loading the main app. Use together with gar_shiny_auth
gar_shiny_ui(ui, login_ui = silent_auth)
ui |
A Shiny ui object |
login_ui |
A UI or HTML template that is seen before the main app and contains a login in link generated by gar_shiny_auth_url |
Put this at the bottom of your ui.R or pass into shinyApp wrapping your created ui.
Based on this gist by Joe Cheng, RStudio
Other pre-load shiny authentication:
gar_shiny_auth_url()
,
gar_shiny_auth()
,
gar_shiny_login_ui()
,
silent_auth()
## Not run: library(shiny) library(googleAuthR) gar_set_client() fileSearch <- function(query) { googleAuthR::gar_api_generator("https://www.googleapis.com/drive/v3/files/", "GET", pars_args=list(q=query), data_parse_function = function(x) x$files)() } ## ui.R ui <- fluidPage(title = "googleAuthR Shiny Demo", textInput("query", label = "Google Drive query", value = "mimeType != 'application/vnd.google-apps.folder'"), tableOutput("gdrive") ) ## server.R server <- function(input, output, session){ # this is not reactive, no need as you only reach here authenticated gar_shiny_auth(session) output$gdrive <- renderTable({ req(input$query) # no need for with_shiny() fileSearch(input$query) }) } # gar_shiny_ui() needs to wrap the ui you have created above. shinyApp(gar_shiny_ui(ui), server) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.