Logs a user into their Google account for authorized use of the app. Allows app content to be made conditionally available to 3 classes of user:
authGoogleUI(id) authGoogle(input, output, session, appURL, authUsers, icon = "google")
id | An id string that corresponds with the id used to call the module's UI function. |
---|---|
input | shiny server input object |
output | shiny server output object |
session | shiny server session object |
appURL | URL to the hosted app. |
authUsers | A character vector of authorized user email addresses. |
icon | Default |
A list of the user's Google profile details (name, email, etc.)
1. Anonymous (non-logged in) users; 2. Logged in users who are not authenticated against a whitelist; 3. Logged in and authenticated users.
This allows authentication to be managed via Google rather than locally on the shiny server. Only the whitelist of approved users is kept locally.
Login status is stored in session$userData$userLoggedIn()
, a reactive value.
Authentication status is stored in session$userData$userAuthorized()
, a reactive value.
Based on googleAuthR::googleAuth
and googleAuthR::googleAuthUI
.
Your global.R
file should set the following options:
googleAuthR.scopes.selected
:
c("https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile")
googleAuthR.webapp.client_id
: your Google app OAuth id
googleAuthR.webapp.client_secret
: your Google app OAuth "secret"
Be sure to also set appURL
and authUsers
in global.R
.
See the authentication vignette (vignette("authentication", "SpaDES.shiny")
).