| FirebaseEmailPassword | R Documentation |
Manage users using email and password.
An object of class FirebaseEmailPassword.
firebase::Firebase -> firebase::FirebaseAuth -> FirebaseEmailPassword
createdResults of account creation
firebase::Firebase$expose_app()firebase::FirebaseAuth$clear()firebase::FirebaseAuth$delete_user()firebase::FirebaseAuth$expose_auth()firebase::FirebaseAuth$get_access_token()firebase::FirebaseAuth$get_delete_user()firebase::FirebaseAuth$get_id_token()firebase::FirebaseAuth$get_sign_out()firebase::FirebaseAuth$get_signed_in()firebase::FirebaseAuth$get_signed_up()firebase::FirebaseAuth$is_signed_in()firebase::FirebaseAuth$print()firebase::FirebaseAuth$req_sign_in()firebase::FirebaseAuth$req_sign_out()firebase::FirebaseAuth$request_id_token()firebase::FirebaseAuth$set_language_code()firebase::FirebaseAuth$sign_out()new()FirebaseEmailPassword$new(
persistence = c("session", "local", "memory"),
config_path = "firebase.rds",
language_code = NULL,
session = shiny::getDefaultReactiveDomain()
)persistenceHow 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_pathPath to the configuration file as created by firebase_config.
language_codeSets the language to use for the UI.
Supported languages are listed here.
Set to browser to use the default browser language of the user.
sessionA valid shiny session.
Initialiases Firebase Email Password
Initialises the Firebase application client-side.
create()FirebaseEmailPassword$create(email, password)
email, passwordCredentials as entered by the user.
Create an account
self
sign_in()FirebaseEmailPassword$sign_in(email, password)
email, passwordCredentials as entered by the user.
Sign in with email
NULL if successful, the error otherwise.
get_created()FirebaseEmailPassword$get_created()
Get account creation results
A list of length 2 containing success a boolean
indicating wherther creation was successful and response
containing the result of account creation or the error if failed.
reset_password()FirebaseEmailPassword$reset_password(email = NULL)
emailEmail to send reset link to, if missing looks for current logged in user's email.
Reset user password
self
get_reset()FirebaseEmailPassword$get_reset()
Get whether password reset email was successfully sent
A list of length 2 containing success a boolean
indicating whether email reset was successful and response
containing successful or the error.
send_verification_email()FirebaseEmailPassword$send_verification_email()
Send the user a verification email
self
get_verification_email()FirebaseEmailPassword$get_verification_email()
Get result of verification email sending procedure
A list of length 2 containing success a boolean
indicating whether email verification was successfully sent and response
containing successful or the error.
set_password()FirebaseEmailPassword$set_password(password)
passwordThe authenticated user password, the user should be prompted to enter it.
Set user password
Useful to provide ability to change password.
self
get_password()FirebaseEmailPassword$get_password()
Get response from set_password
A list of length 2 containing success a boolean
indicating whether setting password was successfully set and response
containing successful as string or the error.
re_authenticate()FirebaseEmailPassword$re_authenticate(password)
passwordThe authenticated user password, the user should be prompted to enter it.
Re-authenticate the user.
Some security-sensitive actions—such as deleting an account, setting a primary email address, and changing a password—require that the user has recently signed in. If you perform one of these actions, and the user signed in too long ago, the action fails with an error.
self
get_re_authenticated()FirebaseEmailPassword$get_re_authenticated()
Get response from re_authenticate
A list of length 2 containing success a boolean
indicating whether re-authentication was successful and response
containing successful as string or the error.
clone()The objects of this class are cloneable with this method.
FirebaseEmailPassword$clone(deep = FALSE)
deepWhether to make a deep clone.
Also signs in the user if successful.
library(shiny)
library(firebase)
# modals
register <- modalDialog(
title = "Register",
textInput("email_create", "Your email"),
passwordInput("password_create", "Your password"),
footer = actionButton("create", "Register")
)
sign_in <- modalDialog(
title = "Sign in",
textInput("email_signin", "Your email"),
passwordInput("password_signin", "Your password"),
footer = actionButton("signin", "Sign in")
)
ui <- fluidPage(
useFirebase(), # import dependencies
actionButton("register_modal", "Register"),
actionButton("signin_modal", "Signin"),
plotOutput("plot")
)
server <- function(input, output){
f <- FirebaseEmailPassword$new()
# open modals
observeEvent(input$register_modal, {
showModal(register)
})
observeEvent(input$signin_modal, {
showModal(sign_in)
})
# create the user
observeEvent(input$create, {
f$create(input$email_create, input$password_create)
})
# check if creation sucessful
observeEvent(f$get_created(), {
created <- f$get_created()
if(created$success){
removeModal()
showNotification("Account created!", type = "message")
} else {
showNotification("Error!", type = "error")
}
# print results to the console
print(created)
})
observeEvent(input$signin, {
removeModal()
f$sign_in(input$email_signin, input$password_signin)
})
output$plot <- renderPlot({
f$req_sign_in()
plot(cars)
})
}
## Not run: shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.