Comments (2)
It's a great solution but it works.
library(shiny)
library(firebase)
ui <- fluidPage(
useFirebase(),
tags$head(
tags$script(
# ui must be present at launch so we leave it there but hide it
HTML(
"Shiny.addCustomMessageHandler('show-login', (msg) => {
$('#ui-wrapper').show();
})"
)
)
),
div(
id = "ui-wrapper",
style = "display: none;",
firebaseUIContainer()
),
reqSignin(actionButton("signout", "Sign out")),
uiOutput("msg"),
plotOutput("plot")
)
server <- function(input, output, session){
f <- FirebaseUI$
new("local")$
set_providers(
email = TRUE,
yahoo = TRUE,
google = TRUE,
github = TRUE,
twitter = TRUE,
facebook = TRUE,
microsoft = TRUE
)$
launch()
output$plot <- renderPlot({
f$req_sign_in() # require sign in
plot(cars)
})
# Sign in runs twice hence this check
ran <- 0L
observe({
user <- f$get_signed_in() # get logged in user info
ran <<- ran + 1L
if(ran < 2L)
return()
if(is.null(user))
session$sendCustomMessage("show-login", list())
})
output$msg <- renderUI({
f$req_sign_in() # require sign in
user <- f$get_signed_in() # get logged in user info
print(user)
h4("Welcome,", user$response$displayName)
})
observeEvent(input$signout, {
f$sign_out()
})
}
shinyApp(ui, server)
from firebase.
SUPER! Works! Thank you so much!
from firebase.
Related Issues (20)
- Cannot download through remotes::install_github HOT 2
- OAuth redirect stuck in loop (Microsoft) HOT 5
- Microsoft accessToken returned after sign-in returns 401 error when used for Microsoft Graph API HOT 18
- Something is wrong, but I don't know what HOT 8
- Using Firebase with Prerendered Shiny Documents
- Time Zone and Availability of $response$lastLoginAt
- Wordpress connection HOT 10
- Won't install on R 4.3 HOT 2
- Error `Signture issued at time is in the future` HOT 8
- UI allows registration, but not sign in HOT 1
- Sign out button disappears for a gmail user with bslib version 0.5.1 HOT 4
- firebaseUIContainer() does not show up in modal after sign out HOT 10
- Clarification on use of `interactive` needed HOT 4
- add text to firebaseUIContainer HOT 6
- Is there any way to detect a failed login attempt?
- Presence in firebase HOT 1
- Is a username and password login possible (instead of email and password)?
- Exclude firebase from shiny url bookmarking HOT 2
- Bug on RealtimeDatabase HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase.