Notes

Firebase Authentication

See the Firebase Authentication docs for web.

onAuthStateChanged

firebase.auth().onAuthStateChanged(currentUser => {
  if (currentUser) {
    // User is signed in.
  } else {
    // No user is signed in.
  }
});

Register Email/Password

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});

Sign In Email/Password

Create Provider

Google

Facebook

Twitter

GitHub

OAuth sign in with a provider

Popup

Redirect

Phone Auth

First attach a recaptcha using an element ID...

... then capture a phone number from user input and send the sms...

...and finally authenticate with the code from user input.

Last updated