Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dejan94it/shinyOTP

R package that provides Shiny modules to easily implement One-Time Password (OTP) authentication in your Shiny applications.
https://github.com/dejan94it/shinyOTP

package r shiny shiny-apps shinyapps

Last synced: 2 months ago
JSON representation

R package that provides Shiny modules to easily implement One-Time Password (OTP) authentication in your Shiny applications.

Awesome Lists containing this project

README

        

# shinyOTP

`shinyOTP` is an R package that provides Shiny modules to easily implement
One-Time Password (OTP) authentication in your Shiny applications.

## Installation
At the moment you can install only this version from GitHub:

```r
# Install devtools if necessary
# install.packages("devtools")

devtools::install_github("dejan94it/shinyOTP")
```

## Usage

Set email and password from which you want to send OTP code as environmental
variable, and then just use ui and server functions.

Here is a minimal Shiny App:

```r
library(shiny)
library(shinyOTP)

Sys.setenv(SMTP_EMAIL = "youremail")
Sys.setenv(SMTP_PASSWORD = "yourpassword")

ui <- fluidPage(
fluidRow(otp_ui("otp_module")),
fluidRow(htmlOutput("do_something"))
)

server <- function(input, output, session) {
is_verified <- otp_server(
"otp_module",
smtp_email = "SMTP_EMAIL",
smtp_password = "SMTP_PASSWORD",
smtp_host = "yoursmtphost", #example: smtp.gmail.com
smtp_port = 465, #search the port number of your smtp host
ssl = TRUE, #paired with host and port usually
)

output$do_something <- renderUI({
if(is_verified()){
return(h2("Do something when verified!"))
} else {
return(NULL)
}
})
}

shinyApp(ui, server)

```