To make sure that users who access your shiny.crunch.io app are allowed to access it, use crunchyServer() instead of shiny::shinyServer(), and wrap your UI content inside crunchyBody(). This will prevent anyone who is not logged into Crunch in their browser from accessing your app.

crunchyServer(func, authz = getOption("crunchy.authorization"))

Arguments

func

A function (input, output, session), as you'd normally give to shinyServer(). If the user is not authenticated or authorized, this function will not be evaluated.

authz

A function (input, output, session) to evaluate to determine if the current user is authorized to enter the app. Since it will be called repeatedly, it should be cheap to execute.

Value

Invisibly, a Shiny server function with the auth logic wrapped around func.

Details

To restrict access further to only certain Crunch users, you can set an authorization method, either by passing a server function to the authz argument of this function, or by calling setCrunchyAuthorization().

For a simple example app using crunchyServer(), copy system.file("example_apps/crunchy_server/app.R", package="crunchy"), supply your dataset id on line 14, and run it.

See also

crunchyBody() for wrapping the UI contents, crunchyPublicBody() for specifying an alternate UI for when the user is not authenticated, crunchyUnauthorizedBody() for giving an alternate UI for users who are authenticated with Crunch but not authorized to view this app, and setCrunchyAuthorization() for governing who is authorized to view your app.