11

Can the login details be passed from shinyproxy to shiny app?
I want to write sql query to filter content and display the data that pertains to that user alone.

Balajee
  • 143
  • 1
  • 2
  • 13

1 Answers1

11

This is perfectly possible. As the configuration page of the manual mentions, when a user is authenticated, the following environment variables will be available in any Shiny application launched by the user:

  • SHINYPROXY_USERNAME: the name of the user, as used when logging in
  • SHINYPROXY_USERGROUPS: the groups the authenticated user is a member of, as a comma-separated value

From within the Shiny app, you can then query this information using

userName <- Sys.getenv("SHINYPROXY_USERNAME")

and use that downstream in your SQL queries.

Lukas Thaler
  • 2,672
  • 5
  • 15
  • 31
Tobias Verbeke
  • 422
  • 4
  • 7