Skip to content

Instantly share code, notes, and snippets.

@kabircse
Forked from renjithspace/firebase-cheatsheet.md
Created August 23, 2021 03:28
Show Gist options
  • Save kabircse/422d38fbd737c0c3112f823a13c4dec8 to your computer and use it in GitHub Desktop.
Save kabircse/422d38fbd737c0c3112f823a13c4dec8 to your computer and use it in GitHub Desktop.
Firebase cheatsheet

Getting started

// Initialize
firebase.initializeApp(config)

// App
firebase.app()

// Get app name
firebase.app().name

Authentication

// Sign in pre-build UI
ui.start(element, options)

// Auth
firebase.auth()

// Create user with email and password 
firebase.auth().createUserWithEmailAndPassword(email, password)

// Sign in with email and password
firebase.auth().signInWithEmailAndPassword(email, password)

// On auth state changed
firebase.auth().onAuthStateChanged(user)

// Current user
firebase.auth().currentUser

// Auth providers data
user.providerData

// Update profile
user.updateProfile({ displayName, photoURL})

// Update email
user.updateEmail(email)

// Send email verification
user.sendEmailVerification()

// Set auth language for emails
firebase.auth().languageCode = 'fr'

// Use device language
firebase.auth().useDeviceLanguage()

// Update password
user.updatePassword(newPassword)

// Send password reset email
firebase.auth().sendPasswordResetEmail(email)

// Delete user
user.delete()

// Re-authenticate user
user.reauthenticateWithCredential(credential)

// Sign out
firebase.auth().signOut()

Database

// Database
firebase.database()

Storage

// Storage
firebase.storage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment