Learn R Programming

firebase (version 0.1.0)

FirebaseEmailLink: Email Link

Description

Sign in the user by emailing them a link.

Arguments

Super class

firebase::Firebase -> FirebaseEmailLink

Active bindings

email_verification

Email verification results

email_sent

Email send results

Methods

Public methods

Method config()

Usage

FirebaseEmailLink$config(url, ...)

Arguments

url

The link is handled in the web action widgets, this is the deep link in the continueUrl query parameter. Likely, your shiny application link.

...

Any other parameter from the official documentation.

Details

Configure

Examples

\dontrun{
f <- FirebaseEmailLink$
 new()$ # create
 config(url = "https://me.shinyapps.io/myApp/")
}

Method send()

Usage

FirebaseEmailLink$send(email)

Arguments

email

Email to send verification to.

Details

Send email verification link.

Returns

self

Examples

\dontrun{
f <- FirebaseEmailLink$
 new()$ # create
 config(url = "https://me.shinyapps.io/myApp/")$
 send("user@email.com")
}

Method get_email_sent()

Usage

FirebaseEmailLink$get_email_sent()

Details

Get whether email verification was correctly sent.

Returns

A list of length 2 containing success a boolean indicating wherther sending the email was successful and response containing the email used to sign in or the error if sending failed.

Method get_email_verification()

Usage

FirebaseEmailLink$get_email_verification()

Details

Get whether user is signing in from email verification.

Returns

A list of length 2 containing success a boolean indicating wherther signing in from the verification link was successful and response containing the result of the sign in or the error if signing in failed.

Method clone()

The objects of this class are cloneable with this method.

Usage

FirebaseEmailLink$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
# NOT RUN {
library(shiny)
library(firebase)

options(shiny.port = 3000) 

ui <- fluidPage(
  useFirebase(),
  textInput("email", "Your email"),
  actionButton("submit", "Submit")
)

server <- function(input, output){

  f <- FireblazeEmailLink$
    new()$
    config(url = "http://127.0.0.1:3000")

  observeEvent(input$submit, {
    if(input$email == "")
      return()
    
    f$send(input$email)
  })

  observeEvent(f$get_email_sent(), {
    sent <- f$get_email_sent()

    if(sent$success)
      showNotification("Email sent", type = "message")
  })

  observeEvent(f$get_email_verification(), {
    print(f$get_email_verification())
  })

}

# }
# NOT RUN {
shinyApp(ui, server)
# }
# NOT RUN {

## ------------------------------------------------
## Method `FirebaseEmailLink$config`
## ------------------------------------------------

# }
# NOT RUN {
f <- FirebaseEmailLink$
 new()$ # create
 config(url = "https://me.shinyapps.io/myApp/")
# }
# NOT RUN {
## ------------------------------------------------
## Method `FirebaseEmailLink$send`
## ------------------------------------------------

# }
# NOT RUN {
f <- FirebaseEmailLink$
 new()$ # create
 config(url = "https://me.shinyapps.io/myApp/")$
 send("user@email.com")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab