You might have already browsed the guide on social sign in. They are in fact convenience wrapper to the more general “Oauth providers” class. It works in a very similar fashion and can even prove more convenient.
First, instantiate the authentication from
FirebaseOauthProviders
, then define the provider you want
to use with set_provider
, finally launch
whenever you want.
Below we have the authentication launch at the click of a button. We
provide Microsoft by simply setting microsoft.com
as
provider. All that is needed to change to say Yahoo! is to change the
provider to yahoo.com
for instance.
library(shiny)
library(firebase)
ui <- fluidPage(
useFirebase(),
actionButton("signin", "Sign in with Microsoft", icon = icon("microsoft")),
plotOutput("plot")
)
server <- function(input, output, session){
f <- FirebaseOauthProviders$
new()$
set_provider("microsoft.com")
observeEvent(input$signin, {
f$launch()
})
output$plot <- renderPlot({
f$req_sign_in()
plot(cars)
})
}
shinyApp(ui, server)
The R-side of things is rather easy so here we briefly explain how to integrate those oauth providers with the Firebase console.
For Yahoo it is fairly straightforward. Open you console under “Sign-in method” tab and enable Yahoo! as show below.
To get the necessary app ID and app secret visit this link and create an app
Make sure you enter the “Redirect URI(s)” given to you by Firebase which
resembles
https://my-application.firebaseapp.com/__/auth/handler
and
tick the OpenID Connect Permissions
at the bottom.
On the resulting screen copy the app ID and secret to your Firebase console.
Authenticating via Microsoft is handled by Microsoft Azure, create a free account if you do not have one the:
Once this done give Microsoft 2 minutes to sync before trying the authentication.