The AppIdR
is a package to get authentication with App ID
IBM service in the Shiny Apps.
remotes::install_github("IBM/AppIdR")
In the first, you need generate a config yaml file with:
gen_appid_config(name = "Myapp")
And resulting
# appid_config.yml
name: Myapp
config:
key: !expr Sys.getenv("APPID_KEY") # clientId
secret: !expr Sys.getenv("APPID_SECRET") # secret
redirect_uri: !expr Sys.getenv("APP_URL") # app url
base_url: !expr Sys.getenv("APPID_URL") # oAuthServerUrl
authorize: authorization
access: token
scope: openid
password: !expr Sys.getenv("SECRET") # encrypt token
You should too, create a .Renviron
file with the credentials.
require(shiny)
require(shinydashboard)
require(AppIdR)
ui <- dashboardPage(
dashboardHeader(user_info(), # show user info
title = "My dashboard"),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output, session) {
# if you want get user info in app
userinfo <- callModule(get_user_info, "userinfo")
output$user <- renderText({userinfo()})
}
# modified shinyApp
shinyAppId(ui, server)
- Package using Auth0 service curso-r/auth0
- Gist with Sketch of Shiny + Oauth hadley/shiny-oauth.r