The Firebase Auth quickstart demonstrates several methods for signing in:
- The Firebase email and password authentication quickstart demonstrates using a Firebase stored email & password to authenticate - you can both create and sign in a user.
- The Firebase email link authentication quickstart demonstrates using an email address to sign-in without a password, via a link sent through email - you can both create and sign in a user.
- The Firebase phone number authentication quickstart demonstrates using Firebase phone number authentication using three different techniques: with a visible ReCaptcha, an invisible ReCaptcha and a simplified popup flow (not recommended for production apps).
- The Firebase Google Sign in quickstarts demonstrate using a Google account to authenticate to Firebase using three different techniques: with a popup, a redirect and an auth token.
- The Firebase Facebook Login quickstarts demonstrate using a Facebook account to authenticate to Firebase using three different techniques: with a popup, a redirect and an auth token.
- The Firebase Twitter Login quickstarts demonstrate using a Twitter account to authenticate to Firebase using two different techniques: with a popup and a redirect.
- The Firebase Microsoft Login quickstarts demonstrate using a Microsoft account to authenticate to Firebase using two different techniques: with a popup and a redirect.
- The Firebase GitHub Login quickstarts demonstrate using a GitHub account to authenticate to Firebase using two different techniques: with a popup and a redirect.
- The Firebase Anonymous auth quickstart demonstrates how to authenticate to Firebase anonymously.
- The Firebase custom auth quickstart demonstrates how to authenticate to Firebase with a user who has been authenticated from your own pre-existing authentication system. This is done by generating a token in a specific format, which is signed using the private key from a service account downloaded from the Google Developer Console. This token can then be passed to your client application which uses it to authenticate to Firebase. We provide an example token generator for demonstration purposes. Note: Generating tokens in production should be done server side.
We also provide the code for a Chrome Extension showing how to setup and authorize Firebase in a Chrome extension.
- Create a Firebase project on the Firebase Console.
- Add a support email to your project in the settings page. Some auth methods won't work without this.
- Enable the authentication method you want to use by going to the Authentication section in the SIGN-IN METHOD tab - you don't need to enable custom auth.
- For Custom Auth, generate a Service Account credentials in your Firebase Console > Project Settings > Service Accounts, and click on GENERATE NEW PRIVATE KEYS. You will need it in the example token generator.
- For Facebook, Twitter and GitHub you will need to create an application as a developer on their respective developer platform, whitelist
https://<project_id>.firebaseapp.com/__/auth/handler
for auth redirects and enable and setup the app's credentials in the Firebase Console > Authentication > SIGN-IN METHOD.
- You must have the Firebase CLI installed. If you don't have it install it with
npm install -g firebase-tools
and then configure it withfirebase login
. - On the command line,
cd
into thequickstart-js/auth
subdirectory. - Run
firebase use --add
and select your Firebase project.
To run the sample app locally during development:
- Run
firebase serve
. This will start a server locally that servesauth/index.html
onhttp://localhost:<port>
. Check the output of the command for the exact port. - Navigate in your browser to the URL output by the
firebase serve
command.
To deploy the sample app to production:
- Run
firebase deploy
. This will deploy the sample app tohttps://<project_id>.firebaseapp.com
.
https://firebase.google.com/support/
© Google, 2016. Licensed under an Apache-2 license.