Firebase Auth Quickstarts

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 GitHub Login quickstarts demonstrate using a GitHub account to authenticate to Firebase using two different techniques: with a popup and a redirect.
  • 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 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.

Getting Started

  1. Create a Firebase project on the Firebase Console.
  2. 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.
  3. 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 with firebase login.
  4. On the command line run firebase use --add and select the Firebase project you have created.
  5. Run firebase serve using the Firebase CLI tool to launch a local server and open the sample .html in a web browser.

License

© Google, 2016. Licensed under an Apache-2 license.