authGoogle: Authorize a user using Google Drive account

Description Usage Arguments Details Value Additional requirements Note Author(s)

View source: R/authGoogle.R

Description

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:

Usage

1
2
3
authGoogleUI(id)

authGoogle(input, output, session, appURL, authUsers, icon = "google")

Arguments

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 "google". Name of icon to display beside the login button. Use of an icon with shinydashboard may produce undesired results. Disable use of the icon with icon = NULL.

Details

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.

Value

A list of the user's Google profile details (name, email, etc.)

Additional requirements

Your ‘global.R’ file should set the following options:

  1. googleAuthR.scopes.selected:

    c("https://www.googleapis.com/auth/userinfo.email",
      "https://www.googleapis.com/auth/userinfo.profile")
  2. googleAuthR.webapp.client_id: your Google app OAuth id

  3. 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")).

Note

Based on googleAuthR::googleAuth and googleAuthR::googleAuthUI.

Author(s)

Alex Chubaty


PredictiveEcology/SpaDES.shiny documentation built on Nov. 11, 2019, 7:12 p.m.