Shiny and Pool with database authentication prompts

shiny
shinyappsio
dbi
authentication
pool

#1

I'm building a modularized Shiny app that uses a Pool connection to a SQL Server database. During development I'm pulling in my own SQL Server login credentials from a local .yaml file with the config package. I'm hoping to host the app in shinyapps.io and allow others in my organization to authenticate with their own SQL Server user/pass. I'm having difficulty figuring out how to prompt users for their credentials -- the Pool is created in the global.R file so it will be available to the various modules. Is there a way to put user/pass input fields in a module and pass the values back to the Pool connection string somehow? Or should I create the Pool somewhere else other than global.R to make this work? Thanks in advance!


#2

I would separate the pool authentication from the user authentication. This allows all users to use the same Pool Connection object (and the benefits of Pool).

https://shiny.rstudio.com/gallery/authentication-and-database.html is a good example with user auth plus a regular shiny app behind the auth.

Link to code: https://gist.github.com/trestletech/9793754