The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/auth

auth package

Firebase Authentication

Classes

Class Description
ActionCodeURL A utility class to parse email action URLs such as password reset, email verification, email link sign in, etc.
AuthCredential Interface that represents the credentials returned by an AuthProvider.
EmailAuthCredential Interface that represents the credentials returned by EmailAuthProvider for ProviderId.PASSWORD
EmailAuthProvider Provider for generating EmailAuthCredential.
FacebookAuthProvider Provider for generating an OAuthCredential for ProviderId.FACEBOOK.
GithubAuthProvider Provider for generating an OAuthCredential for ProviderId.GITHUB.
GoogleAuthProvider Provider for generating an an OAuthCredential for ProviderId.GOOGLE.
OAuthCredential Represents the OAuth credentials returned by an OAuthProvider.
OAuthProvider Provider for generating generic OAuthCredential.
PhoneAuthCredential Represents the credentials returned by PhoneAuthProvider.
PhoneAuthProvider Provider for generating an PhoneAuthCredential.
PhoneMultiFactorGenerator Provider for generating a PhoneMultiFactorAssertion.
RecaptchaVerifier An reCAPTCHA-based application verifier.
SAMLAuthProvider An AuthProvider for SAML.
TwitterAuthProvider Provider for generating an OAuthCredential for ProviderId.TWITTER.

Enumerations

Enumeration Description
ActionCodeOperation An enumeration of the possible email action types.
FactorId An enum of factors that may be used for multifactor authentication.
OperationType Enumeration of supported operation types.
ProviderId Enumeration of supported providers.
SignInMethod Enumeration of supported sign-in methods.

Functions

Function Description
applyActionCode(auth, oobCode) Applies a verification code sent to the user by email or other out-of-band mechanism.
checkActionCode(auth, oobCode) Checks a verification code sent to the user by email or other out-of-band mechanism.
confirmPasswordReset(auth, oobCode, newPassword) Completes the password reset process, given a confirmation code and new password.
createUserWithEmailAndPassword(auth, email, password) Creates a new user account associated with the specified email address and password.
deleteUser(user) Deletes and signs out the user.
fetchSignInMethodsForEmail(auth, email) Gets the list of possible sign in methods for the given email address.
getAdditionalUserInfo(userCredential) Extracts provider specific AdditionalUserInfo for the given credential.
getAuth(app) Initializes an Auth instance with platform specific default dependencies.
getIdToken(user, forceRefresh) Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
getIdTokenResult(user, forceRefresh) Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.
getMultiFactorResolver(auth, error) Provides a MultiFactorResolver suitable for completion of a multi-factor flow.
getRedirectResult(auth, resolver) Returns a UserCredential from the redirect-based sign-in flow.
initializeAuth(app, deps) Initializes an Auth instance with fine-grained control over Dependencies.
isSignInWithEmailLink(auth, emailLink) Checks if an incoming link is a sign-in with email link suitable for signInWithEmailLink().
linkWithCredential(user, credential) Links the user account with the given credentials.
linkWithPhoneNumber(user, phoneNumber, appVerifier) Links the user account with the given phone number.
linkWithPopup(user, provider, resolver) Links the authenticated provider to the user account using a pop-up based OAuth flow.
linkWithRedirect(user, provider, resolver) Links the OAuthProvider to the user account using a full-page redirect flow.
multiFactor(user) The MultiFactorUser corresponding to the user.
onAuthStateChanged(auth, nextOrObserver, error, completed) Adds an observer for changes to the user's sign-in state.
onIdTokenChanged(auth, nextOrObserver, error, completed) Adds an observer for changes to the signed-in user's ID token, which includes sign-in, sign-out, and token refresh events.
parseActionCodeURL(link) Parses the email action link string and returns an ActionCodeURL if the link is valid, otherwise returns null.
reauthenticateWithCredential(user, credential) Re-authenticates a user using a fresh credential.
reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) Re-authenticates a user using a fresh phne credential.
reauthenticateWithPopup(user, provider, resolver) Reauthenticates the current user with the specified OAuthProvider using a pop-up based OAuth flow.
reauthenticateWithRedirect(user, provider, resolver) Reauthenticates the current user with the specified OAuthProvider using a full-page redirect flow.
reload(user) Reloads user account data, if signed in.
sendEmailVerification(user, actionCodeSettings) Sends a verification email to a user.
sendPasswordResetEmail(auth, email, actionCodeSettings) Sends a password reset email to the given email address.
sendSignInLinkToEmail(auth, email, actionCodeSettings) Sends a sign-in email link to the user with the specified email.
setPersistence(auth, persistence) Changes the type of persistence on the Auth instance for the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests.
signInAnonymously(auth) Asynchronously signs in as an anonymous user.
signInWithCredential(auth, credential) Asynchronously signs in with the given credentials.
signInWithCustomToken(auth, customToken) Asynchronously signs in using a custom token.
signInWithEmailAndPassword(auth, email, password) Asynchronously signs in using an email and password.
signInWithEmailLink(auth, email, emailLink) Asynchronously signs in using an email and sign-in email link.
signInWithPhoneNumber(auth, phoneNumber, appVerifier) Asynchronously signs in using a phone number.
signInWithPopup(auth, provider, resolver) Authenticates a Firebase client using a popup-based OAuth authentication flow.
signInWithRedirect(auth, provider, resolver) Authenticates a Firebase client using a full-page redirect flow.
signOut(auth) Signs out the current user.
unlink(user, providerId) Unlinks a provider from a user account.
updateCurrentUser(auth, user) Asynchronously sets the provided user as Auth.currentUser on the Auth instance.
updateEmail(user, newEmail) Updates the user's email address.
updatePassword(user, newPassword) Updates the user's password.
updatePhoneNumber(user, credential) Updates the user's phone number.
updateProfile(user, { displayName, photoURL: photoUrl }) Updates a user's profile data.
useAuthEmulator(auth, url, options) Changes the Auth instance to communicate with the Firebase Auth Emulator, instead of production Firebase Auth services.
useDeviceLanguage(auth) Sets the current language to the default device/browser preference.
verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) Sends a verification email to a new email address.
verifyPasswordResetCode(auth, code) Checks a password reset code sent to the user by email or other out-of-band mechanism.

Interfaces

Interface Description
ActionCodeInfo A response from checkActionCode().
ActionCodeSettings An interface that defines the required continue/state URL with optional Android and iOS bundle identifiers.
AdditionalUserInfo A structure containing additional user information from a federated identity provider.
ApplicationVerifier A verifier for domain verification and abuse prevention.
Auth Interface representing Firebase Auth service.
AuthError Interface for an Auth error.
AuthErrorMap A mapping of error codes to error messages.
AuthProvider Interface that represents an auth provider, used to facilitate creating AuthCredential.
AuthSettings Interface representing an Auth instance's settings.
Config Interface representing the Auth config.
ConfirmationResult A result from a phone number sign-in, link, or reauthenticate call.
Dependencies The dependencies that can be used to initialize an Auth instance.
IdTokenResult Interface representing ID token result obtained from User.getIdTokenResult().
MultiFactorAssertion The base class for asserting ownership of a second factor.
MultiFactorError The error thrown when the user needs to provide a second factor to sign in successfully.
MultiFactorInfo A structure containing the information of a second factor entity.
MultiFactorResolver The class used to facilitate recovery from MultiFactorError when a user needs to provide a second factor to sign in.
MultiFactorSession An interface defining the multi-factor session object used for enrolling a second factor on a user or helping sign in an enrolled user with a second factor.
MultiFactorUser An interface that defines the multi-factor related properties and operations pertaining to a User.
OAuthCredentialOptions Defines the options for initializing an OAuthCredential.
ParsedToken Interface representing a parsed ID token.
Persistence An interface covering the possible persistence mechanism types.
PhoneMultiFactorAssertion The class for asserting ownership of a phone second factor. Provided by PhoneMultiFactorGenerator.assertion().
PhoneMultiFactorEnrollInfoOptions Options used for enrolling a second factor.
PhoneMultiFactorSignInInfoOptions Options used for signing-in with a second factor.
PhoneSingleFactorInfoOptions Options used for single-factor sign-in.
PopupRedirectResolver A resolver used for handling DOM specific operations like signInWithPopup() or signInWithRedirect().
ReactNativeAsyncStorage Interface for a supplied AsyncStorage.
User A user account.
UserCredential A structure containing a User, an AuthCredential, the OperationType, and any additional user information that was returned from the identity provider.
UserInfo User profile information, visible only to the Firebase project's apps.
UserMetadata Interface representing a user's metadata.

Variables

Variable Description
browserLocalPersistence An implementation of Persistence of type 'LOCAL' using localStorage for the underlying storage.
browserPopupRedirectResolver An implementation of PopupRedirectResolver suitable for browser based applications.
browserSessionPersistence An implementation of Persistence of 'SESSION' using sessionStorage for the underlying storage.
debugErrorMap A verbose error map with detailed descriptions for most error codes.See discussion at AuthErrorMap
indexedDBLocalPersistence An implementation of Persistence of type 'LOCAL' using indexedDB for the underlying storage.
inMemoryPersistence An implementation of Persistence of type 'NONE'.
prodErrorMap A minimal error map with all verbose error messages stripped.See discussion at AuthErrorMap

Type Aliases

Type Alias Description
CustomParameters Map of OAuth Custom Parameters.
NextOrObserver Type definition for an event callback.
PhoneInfoOptions The information required to verify the ownership of a phone number.
UserProfile User profile used in AdditionalUserInfo.