FirebaseUI is a library built on top of the Firebase Authentication SDK that provides drop-in UI flows for use in your app. FirebaseUI provides the following benefits: Show
Before you begin
Initialize FirebaseUIAfter importing the SDK, initialize the Auth UI.
Set up sign-in methodsBefore you can use Firebase to sign in users, you must enable and configure the sign-in methods you want to support. Email address and password
Email link authentication
OAuth providers (Google, Facebook, Twitter and GitHub)
Phone number
Sign inTo kick off the FirebaseUI sign in flow, initialize the FirebaseUI instance by passing the underlying $ bower install firebaseui --save3 instance.
Define the HTML element where the FirebaseUI sign-in widget will be rendered. 6Specify the FirebaseUI configuration (providers supported and UI customizations as well as success callbacks, etc). 7Finally, render the FirebaseUI Auth interface: 8Upgrading anonymous usersEnabling anonymous user upgradeWhen an anonymous user signs in or signs up with a permanent account, you want to be sure the user can continue with what they were doing before signing up. To do so, simply set $ bower install firebaseui --save4 to var firebase = require('firebase'); var firebaseui = require('firebaseui');4 when you configure the sign-in UI (this option is disabled by default). Handling anonymous user upgrade merge conflictsThere are cases when a user, initially signed in anonymously, tries to upgrade to an existing Firebase user. Since an existing user cannot be linked to another existing user, FirebaseUI will trigger the $ bower install firebaseui --save6 callback with an error code $ bower install firebaseui --save7 when the above occurs. The error object will also contain the permanent credential. Sign-in with the permanent credential should be triggered in the callback to complete sign-in. Before sign-in can be completed via $ bower install firebaseui --save8, you must save the anonymous user's data and delete the anonymous user. Then, after sign-in completion, copy the data back to the non-anonymous user. An example below illustrates how this flow would work. |