Movatterモバイル変換


[0]ホーム

URL:


Type:Package
Title:Authentication in Shiny with Auth0
Version:0.2.3
Description:Uses Auth0 API (seehttps://auth0.com for more information) to use a simple authentication system. It provides tools to log in and out a shiny application using social networks or a list of e-mails.
BugReports:https://github.com/curso-r/auth0/issues
License:MIT + file LICENSE
Encoding:UTF-8
RoxygenNote:7.2.3
Imports:httr, shiny, yaml, utils, shinyjs
Suggests:knitr, rmarkdown
VignetteBuilder:knitr
URL:https://curso-r.github.io/auth0/
NeedsCompilation:no
Packaged:2023-03-22 18:59:25 UTC; julio
Author:Julio Trecenti [cre], Daniel Falbel [aut], José Jesus [ctb], Dean Attali [ctb], C Lente [ctb]
Maintainer:Julio Trecenti <julio.trecenti@gmail.com>
Repository:CRAN
Date/Publication:2023-03-26 21:50:05 UTC

Parse⁠_auth0.yml⁠ file.

Description

Validates and creates a list of useful information fromthe⁠_auth0.yml⁠ file.

Usage

auth0_config(config_file)

Arguments

config_file

path to the⁠_auth0.yml⁠ file. If not informed,will try to find the file usingauth0_find_config_file.

Value

List containing all the information from the⁠_auth0.yml⁠ file.


Find the configuration file.

Description

Tries to find the path to the⁠_auth0.yml⁠ file. First, it tries to getthis info fromoptions(auth0_config_file = ). If this option isNULL(the default) it tries to find the⁠_auth0.yml⁠ within the workingdirectory. If the file does not exist, it raises an error.

Usage

auth0_find_config_file()

Value

Character vector of length one contaning the path of the⁠_auth0.yml⁠ file.

See Also

use_auth0.


Information used to connect to Auth0.

Description

Creates a list containing all the important information to connect to Auth0service's API.

Usage

auth0_info(config)

Arguments

config

path to the⁠_auth0.yml⁠ file or the object returned byauth0_config. If not informed, will try to find the file usingauth0_find_config_file.

Value

A list contaning scope, state, keys, OAuth2.0 app, endpoints,audience andremote URL. For compatibility reasons,remote_url can be either a parameterin the root yaml or inside ashiny_config parameter.

See Also

use_auth0 to create an⁠_auth0.yml⁠ template.


Generate logout URL

Description

auth0_logout_url() is defunct as of auth0 0.1.2 in order to simplifly theuser experience with thelogoutButton() function.

Usage

auth0_logout_url(config_file = NULL, redirect_js = TRUE)

Arguments

config_file

Path to YAML configuration file.

redirect_js

include javascript code to redirect page? Defaults toTRUE.

Examples

# simple UI with action button# AFTER auth0 0.1.2if (interactive()) {  library(shiny)  library(auth0)  ui <- fluidPage(logoutButton())  server <- function(input, output, session) {}  config_file <- system.file("simple/_auth0.yml", package = "auth0")  shinyAppAuth0(ui, server, config_file)  # simple UI with action button  # BEFORE auth0 0.1.2  library(shiny)  library(auth0)  library(shinyjs)  # note that you must include shinyjs::useShinyjs() for this to work  ui <- fluidPage(shinyjs::useShinyjs(), actionButton("logout_auth0", "Logout"))  # server with one observer that logouts  server <- function(input, output, session) {    observeEvent(input$logout_auth0, {      # javascript code redirecting to correct url      js <- auth0_logout_url()      shinyjs::runjs(js)    })  }  shinyAuth0App(ui, server, config_file)}

Log out of an auth0 app

Description

Log the current user out of an auth0 shiny app.

Usage

logout()

Details

You can also use a diferent configuration file by setting theauth0_config_file option with:options(auth0_config_file = "path/to/file.yaml").

See Also

logoutButton,logout_url


Create a button to log out

Description

AlogoutButton is anactionButton that is meantto be used to log out of an auth0 Shiny app.

Usage

logoutButton(label = "Log out", ..., id = "._auth0logout_")

Arguments

label

The label on the button.

...

Named attributes to apply to the button.

id

An ID for the button. If you only have one logout button inyour app, you do not need to explicitly provide an ID. If you have more thanone logout button, you need to provide a unique ID to each button. When youcreate a button with a non-default ID, you must create an observer thatlistens to a click on this button and logs out of the app with a call tologout.

See Also

logout,logout_url

Examples

if (interactive()) {  ui <- fluidPage(    logoutButton(),    logoutButton(label = "Another logout button", id = "logout2")  )  server <- function(input, output, session) {    observeEvent(input$logout2, {      logout()    })  }  shinyAuth0App(ui, server)}

Generate a logout URL

Description

Generate a URL that will log the user out of the app if visited.

Usage

logout_url()

Details

You can also use a diferent configuration file by setting theauth0_config_file option with:options(auth0_config_file = "path/to/file.yaml").

Value

URL string to log out.

See Also

logoutButton,logout


Create a Shiny app object with Auth0 Authentication

Description

This function modifies ui and server objects to run using Auth0authentication.

Usage

shinyAppAuth0(ui, server, config_file = NULL, ...)

Arguments

ui

an ordinary UI object to create shiny apps.

server

an ordinary server object to create shiny apps.

config_file

path to YAML configuration file.

...

Other arguments passed on toshiny::shinyApp().

Details

You can also use a diferent configuration file by setting theauth0_config_file option with:options(auth0_config_file = "path/to/file.yaml").

Disable auth0 while developing apps

Sometimes, using auth0 to develop and test apps can be frustrating,because every time the app is started, auth0 requires the user to log-in.To avoid this problem, one can runoptions(auth0_disable = TRUE) todisable auth0 temporarily.


Create a Shiny app object with Auth0 Authentication

Description

As of auth0 0.1.2,shinAuth0App() hasbeen renamed toshinyAppAuth0() for consistency.

Usage

shinyAuth0App(ui, server, config_file = NULL)

Arguments

ui

an ordinary UI object to create shiny apps.

server

an ordinary server object to create shiny apps.

config_file

path to YAML configuration file.


Modifies ui/server objects to authenticate using Auth0.

Description

These functions can be used in a ui.R/server.R framework, modifying theshiny objects to authenticate using Auth0 service with no pain.

Usage

auth0_ui(ui, info)auth0_server(server, info)

Arguments

ui

shiny.tag.list object to generate the user interface.

info

object returned fromauth0_info. If not informed,will try to find the⁠_auth0.yml⁠ and create it automatically.

server

the shiny server function.

See Also

auth0_info.

Examples

# first, create the yml file using use_auth0() functionif (interactive()) {  # ui.R file  library(shiny)  library(auth0)  auth0_ui(fluidPage(logoutButton()))  # server.R file  library(auth0)  auth0_server(function(input, output, session) {})  # console  options(shiny.port = 8080)  shiny::runApp()}

Auth0 configuration file

Description

Create an YAML containing information to connect with Auth0.

Usage

use_auth0(path = ".", file = "_auth0.yml", overwrite = FALSE)

Arguments

path

Directory name. Should be the root of the shiny appyou want to add this functionality

file

File name. Defaults to⁠_auth0.yml⁠.

overwrite

Will only overwrite existing path ifTRUE.

Details

The YAML configuration file has required parameters and extraparameters.

The required parameters are:

The extra parameters are:


[8]ページ先頭

©2009-2025 Movatter.jp