FirebaseEmailLink: Email Link

FirebaseEmailLinkR Documentation

Email Link

Description

Sign in the user by emailing them a link.

Value

An object of class FirebaseEmailLink.

Super classes

firebase::Firebase -> firebase::FirebaseAuth -> FirebaseEmailLink

Active bindings

email_verification

Email verification results

email_sent

Email send results

Methods

Public methods

Inherited methods

Method new()

Usage
FirebaseEmailLink$new(
  persistence = c("session", "local", "memory"),
  config_path = "firebase.rds",
  language_code = NULL,
  session = shiny::getDefaultReactiveDomain()
)
Arguments
persistence

How the auth should persit: none, the user has to sign in at every visit, session will only persist in current tab, local persist even when window is closed.

config_path

Path to the configuration file as created by firebase_config.

language_code

Sets the language to use for the UI. Supported languages are listed here. Set to browser to use the default browser language of the user.

session

A valid shiny session.

Details

Initialiases Firebase Email Link

Initialises the Firebase application client-side.


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_email()

Usage
FirebaseEmailLink$send_email(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.

Note

Other methods to pick up whether user signs in still apply. This is for added security measures.

Examples

library(shiny)
library(firebase)
old <- options()
options(shiny.port = 3000) 

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

server <- function(input, output){

  f <- FirebaseEmailLink$
    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())
  })

}

if(interactive()){
   shinyApp(ui, server)
}


options(old)


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

## Not run: 
f <- FirebaseEmailLink$
 new()$ # create
 config(url = "https://me.shinyapps.io/myApp/")

## End(Not run)

## ------------------------------------------------
## Method `FirebaseEmailLink$send_email`
## ------------------------------------------------

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

## End(Not run)


firebase documentation built on July 9, 2023, 7:07 p.m.