@firebase/auth

  • Version 1.7.1
  • Published
  • 18 MB
  • 5 dependencies
  • Apache-2.0 license

Install

npm i @firebase/auth
yarn add @firebase/auth
pnpm add @firebase/auth

Overview

Firebase Authentication

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable ActionCodeOperation

const ActionCodeOperation: {
readonly EMAIL_SIGNIN: 'EMAIL_SIGNIN';
readonly PASSWORD_RESET: 'PASSWORD_RESET';
readonly RECOVER_EMAIL: 'RECOVER_EMAIL';
readonly REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION';
readonly VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL';
readonly VERIFY_EMAIL: 'VERIFY_EMAIL';
};
  • An enumeration of the possible email action types.

    Modifiers

    • @public

variable AuthErrorCodes

const AuthErrorCodes: {
readonly ADMIN_ONLY_OPERATION: 'auth/admin-restricted-operation';
readonly ARGUMENT_ERROR: 'auth/argument-error';
readonly APP_NOT_AUTHORIZED: 'auth/app-not-authorized';
readonly APP_NOT_INSTALLED: 'auth/app-not-installed';
readonly CAPTCHA_CHECK_FAILED: 'auth/captcha-check-failed';
readonly CODE_EXPIRED: 'auth/code-expired';
readonly CORDOVA_NOT_READY: 'auth/cordova-not-ready';
readonly CORS_UNSUPPORTED: 'auth/cors-unsupported';
readonly CREDENTIAL_ALREADY_IN_USE: 'auth/credential-already-in-use';
readonly CREDENTIAL_MISMATCH: 'auth/custom-token-mismatch';
readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: 'auth/requires-recent-login';
readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: 'auth/dependent-sdk-initialized-before-auth';
readonly DYNAMIC_LINK_NOT_ACTIVATED: 'auth/dynamic-link-not-activated';
readonly EMAIL_CHANGE_NEEDS_VERIFICATION: 'auth/email-change-needs-verification';
readonly EMAIL_EXISTS: 'auth/email-already-in-use';
readonly EMULATOR_CONFIG_FAILED: 'auth/emulator-config-failed';
readonly EXPIRED_OOB_CODE: 'auth/expired-action-code';
readonly EXPIRED_POPUP_REQUEST: 'auth/cancelled-popup-request';
readonly INTERNAL_ERROR: 'auth/internal-error';
readonly INVALID_API_KEY: 'auth/invalid-api-key';
readonly INVALID_APP_CREDENTIAL: 'auth/invalid-app-credential';
readonly INVALID_APP_ID: 'auth/invalid-app-id';
readonly INVALID_AUTH: 'auth/invalid-user-token';
readonly INVALID_AUTH_EVENT: 'auth/invalid-auth-event';
readonly INVALID_CERT_HASH: 'auth/invalid-cert-hash';
readonly INVALID_CODE: 'auth/invalid-verification-code';
readonly INVALID_CONTINUE_URI: 'auth/invalid-continue-uri';
readonly INVALID_CORDOVA_CONFIGURATION: 'auth/invalid-cordova-configuration';
readonly INVALID_CUSTOM_TOKEN: 'auth/invalid-custom-token';
readonly INVALID_DYNAMIC_LINK_DOMAIN: 'auth/invalid-dynamic-link-domain';
readonly INVALID_EMAIL: 'auth/invalid-email';
readonly INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme';
readonly INVALID_IDP_RESPONSE: 'auth/invalid-credential';
readonly INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential';
readonly INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload';
readonly INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session';
readonly INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id';
readonly INVALID_OAUTH_PROVIDER: 'auth/invalid-oauth-provider';
readonly INVALID_OOB_CODE: 'auth/invalid-action-code';
readonly INVALID_ORIGIN: 'auth/unauthorized-domain';
readonly INVALID_PASSWORD: 'auth/wrong-password';
readonly INVALID_PERSISTENCE: 'auth/invalid-persistence-type';
readonly INVALID_PHONE_NUMBER: 'auth/invalid-phone-number';
readonly INVALID_PROVIDER_ID: 'auth/invalid-provider-id';
readonly INVALID_RECIPIENT_EMAIL: 'auth/invalid-recipient-email';
readonly INVALID_SENDER: 'auth/invalid-sender';
readonly INVALID_SESSION_INFO: 'auth/invalid-verification-id';
readonly INVALID_TENANT_ID: 'auth/invalid-tenant-id';
readonly MFA_INFO_NOT_FOUND: 'auth/multi-factor-info-not-found';
readonly MFA_REQUIRED: 'auth/multi-factor-auth-required';
readonly MISSING_ANDROID_PACKAGE_NAME: 'auth/missing-android-pkg-name';
readonly MISSING_APP_CREDENTIAL: 'auth/missing-app-credential';
readonly MISSING_AUTH_DOMAIN: 'auth/auth-domain-config-required';
readonly MISSING_CODE: 'auth/missing-verification-code';
readonly MISSING_CONTINUE_URI: 'auth/missing-continue-uri';
readonly MISSING_IFRAME_START: 'auth/missing-iframe-start';
readonly MISSING_IOS_BUNDLE_ID: 'auth/missing-ios-bundle-id';
readonly MISSING_OR_INVALID_NONCE: 'auth/missing-or-invalid-nonce';
readonly MISSING_MFA_INFO: 'auth/missing-multi-factor-info';
readonly MISSING_MFA_SESSION: 'auth/missing-multi-factor-session';
readonly MISSING_PHONE_NUMBER: 'auth/missing-phone-number';
readonly MISSING_SESSION_INFO: 'auth/missing-verification-id';
readonly MODULE_DESTROYED: 'auth/app-deleted';
readonly NEED_CONFIRMATION: 'auth/account-exists-with-different-credential';
readonly NETWORK_REQUEST_FAILED: 'auth/network-request-failed';
readonly NULL_USER: 'auth/null-user';
readonly NO_AUTH_EVENT: 'auth/no-auth-event';
readonly NO_SUCH_PROVIDER: 'auth/no-such-provider';
readonly OPERATION_NOT_ALLOWED: 'auth/operation-not-allowed';
readonly OPERATION_NOT_SUPPORTED: 'auth/operation-not-supported-in-this-environment';
readonly POPUP_BLOCKED: 'auth/popup-blocked';
readonly POPUP_CLOSED_BY_USER: 'auth/popup-closed-by-user';
readonly PROVIDER_ALREADY_LINKED: 'auth/provider-already-linked';
readonly QUOTA_EXCEEDED: 'auth/quota-exceeded';
readonly REDIRECT_CANCELLED_BY_USER: 'auth/redirect-cancelled-by-user';
readonly REDIRECT_OPERATION_PENDING: 'auth/redirect-operation-pending';
readonly REJECTED_CREDENTIAL: 'auth/rejected-credential';
readonly SECOND_FACTOR_ALREADY_ENROLLED: 'auth/second-factor-already-in-use';
readonly SECOND_FACTOR_LIMIT_EXCEEDED: 'auth/maximum-second-factor-count-exceeded';
readonly TENANT_ID_MISMATCH: 'auth/tenant-id-mismatch';
readonly TIMEOUT: 'auth/timeout';
readonly TOKEN_EXPIRED: 'auth/user-token-expired';
readonly TOO_MANY_ATTEMPTS_TRY_LATER: 'auth/too-many-requests';
readonly UNAUTHORIZED_DOMAIN: 'auth/unauthorized-continue-uri';
readonly UNSUPPORTED_FIRST_FACTOR: 'auth/unsupported-first-factor';
readonly UNSUPPORTED_PERSISTENCE: 'auth/unsupported-persistence-type';
readonly UNSUPPORTED_TENANT_OPERATION: 'auth/unsupported-tenant-operation';
readonly UNVERIFIED_EMAIL: 'auth/unverified-email';
readonly USER_CANCELLED: 'auth/user-cancelled';
readonly USER_DELETED: 'auth/user-not-found';
readonly USER_DISABLED: 'auth/user-disabled';
readonly USER_MISMATCH: 'auth/user-mismatch';
readonly USER_SIGNED_OUT: 'auth/user-signed-out';
readonly WEAK_PASSWORD: 'auth/weak-password';
readonly WEB_STORAGE_UNSUPPORTED: 'auth/web-storage-unsupported';
readonly ALREADY_INITIALIZED: 'auth/already-initialized';
readonly RECAPTCHA_NOT_ENABLED: 'auth/recaptcha-not-enabled';
readonly MISSING_RECAPTCHA_TOKEN: 'auth/missing-recaptcha-token';
readonly INVALID_RECAPTCHA_TOKEN: 'auth/invalid-recaptcha-token';
readonly INVALID_RECAPTCHA_ACTION: 'auth/invalid-recaptcha-action';
readonly MISSING_CLIENT_TYPE: 'auth/missing-client-type';
readonly MISSING_RECAPTCHA_VERSION: 'auth/missing-recaptcha-version';
readonly INVALID_RECAPTCHA_VERSION: 'auth/invalid-recaptcha-version';
readonly INVALID_REQ_TYPE: 'auth/invalid-req-type';
};
  • A map of potential Auth error codes, for easier comparison with errors thrown by the SDK.

    Remarks

    Note that you can't tree-shake individual keys in the map, so by using the map you might substantially increase your bundle size.

    Modifiers

    • @public

variable browserLocalPersistence

const browserLocalPersistence: Persistence;
  • An implementation of Persistence of type LOCAL using localStorage for the underlying storage.

    Modifiers

    • @public

variable browserPopupRedirectResolver

const browserPopupRedirectResolver: PopupRedirectResolver;
  • An implementation of PopupRedirectResolver suitable for browser based applications.

    Remarks

    This method does not work in a Node.js environment.

    Modifiers

    • @public

variable browserSessionPersistence

const browserSessionPersistence: Persistence;
  • An implementation of Persistence of SESSION using sessionStorage for the underlying storage.

    Modifiers

    • @public

variable debugErrorMap

const debugErrorMap: AuthErrorMap;
  • A verbose error map with detailed descriptions for most error codes.

    See discussion at AuthErrorMap

    Modifiers

    • @public

variable FactorId

const FactorId: { readonly PHONE: 'phone'; readonly TOTP: 'totp' };
  • An enum of factors that may be used for multifactor authentication.

    Modifiers

    • @public

variable indexedDBLocalPersistence

const indexedDBLocalPersistence: Persistence;
  • An implementation of Persistence of type LOCAL using indexedDB for the underlying storage.

    Modifiers

    • @public

variable inMemoryPersistence

const inMemoryPersistence: Persistence;
  • An implementation of Persistence of type 'NONE'.

    Modifiers

    • @public

variable OperationType

const OperationType: {
readonly LINK: 'link';
readonly REAUTHENTICATE: 'reauthenticate';
readonly SIGN_IN: 'signIn';
};
  • Enumeration of supported operation types.

    Modifiers

    • @public

variable prodErrorMap

const prodErrorMap: AuthErrorMap;
  • A minimal error map with all verbose error messages stripped.

    See discussion at AuthErrorMap

    Modifiers

    • @public

variable ProviderId

const ProviderId: {
readonly FACEBOOK: 'facebook.com';
readonly GITHUB: 'github.com';
readonly GOOGLE: 'google.com';
readonly PASSWORD: 'password';
readonly PHONE: 'phone';
readonly TWITTER: 'twitter.com';
};
  • Enumeration of supported providers.

    Modifiers

    • @public

variable SignInMethod

const SignInMethod: {
readonly EMAIL_LINK: 'emailLink';
readonly EMAIL_PASSWORD: 'password';
readonly FACEBOOK: 'facebook.com';
readonly GITHUB: 'github.com';
readonly GOOGLE: 'google.com';
readonly PHONE: 'phone';
readonly TWITTER: 'twitter.com';
};
  • Enumeration of supported sign-in methods.

    Modifiers

    • @public

Functions

function applyActionCode

applyActionCode: (auth: Auth, oobCode: string) => Promise<void>;
  • Applies a verification code sent to the user by email or other out-of-band mechanism.

    Parameter auth

    The Auth instance.

    Parameter oobCode

    A verification code sent to the user.

    Modifiers

    • @public

function beforeAuthStateChanged

beforeAuthStateChanged: (
auth: Auth,
callback: (user: User | null) => void | Promise<void>,
onAbort?: () => void
) => Unsubscribe;
  • Adds a blocking callback that runs before an auth state change sets a new user.

    Parameter auth

    The Auth instance.

    Parameter callback

    callback triggered before new user value is set. If this throws, it blocks the user from being set.

    Parameter onAbort

    callback triggered if a later beforeAuthStateChanged() callback throws, allowing you to undo any side effects.

function checkActionCode

checkActionCode: (auth: Auth, oobCode: string) => Promise<ActionCodeInfo>;
  • Checks a verification code sent to the user by email or other out-of-band mechanism.

    Parameter auth

    The Auth instance.

    Parameter oobCode

    A verification code sent to the user.

    Returns

    metadata about the code.

    Modifiers

    • @public

function confirmPasswordReset

confirmPasswordReset: (
auth: Auth,
oobCode: string,
newPassword: string
) => Promise<void>;
  • Completes the password reset process, given a confirmation code and new password.

    Parameter auth

    The Auth instance.

    Parameter oobCode

    A confirmation code sent to the user.

    Parameter newPassword

    The new password.

    Modifiers

    • @public

function connectAuthEmulator

connectAuthEmulator: (
auth: Auth,
url: string,
options?: { disableWarnings: boolean }
) => void;
  • Changes the Auth instance to communicate with the Firebase Auth Emulator, instead of production Firebase Auth services.

    Parameter auth

    The Auth instance.

    Parameter url

    The URL at which the emulator is running (eg, 'http://localhost:9099').

    Parameter options

    Optional. options.disableWarnings defaults to false. Set it to true to disable the warning banner attached to the DOM.

    Remarks

    This must be called synchronously immediately following the first call to initializeAuth. Do not use with production credentials as emulator traffic is not encrypted.

    Example 1

    connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });

    Modifiers

    • @public

function createUserWithEmailAndPassword

createUserWithEmailAndPassword: (
auth: Auth,
email: string,
password: string
) => Promise<UserCredential>;
  • Creates a new user account associated with the specified email address and password.

    Parameter auth

    The Auth instance.

    Parameter email

    The user's email address.

    Parameter password

    The user's chosen password.

    Remarks

    On successful creation of the user account, this user will also be signed in to your application.

    User account creation can fail if the account already exists or the password is invalid.

    This method is not supported on Auth instances created with a @firebase/app#FirebaseServerApp.

    Note: The email address acts as a unique identifier for the user and enables an email-based password reset. This function will create a new user account and set the initial user password.

    Modifiers

    • @public

function deleteUser

deleteUser: (user: User) => Promise<void>;
  • Deletes and signs out the user.

    Parameter user

    The user.

    Remarks

    Important: this is a security-sensitive operation that requires the user to have recently signed in. If this requirement isn't met, ask the user to authenticate again and then call reauthenticateWithCredential.

    Modifiers

    • @public

function fetchSignInMethodsForEmail

fetchSignInMethodsForEmail: (auth: Auth, email: string) => Promise<string[]>;
  • Gets the list of possible sign in methods for the given email address. This method returns an empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of authentication methods available for the given email.

    Parameter auth

    The Auth instance.

    Parameter email

    The user's email address.

    Deprecated. Migrating off of this method is recommended as a security best-practice. Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).

    Remarks

    This is useful to differentiate methods of sign-in for the same provider, eg. EmailAuthProvider which has 2 methods of sign-in, SignInMethod.EMAIL_PASSWORD and SignInMethod.EMAIL_LINK.

    Modifiers

    • @public

function getAdditionalUserInfo

getAdditionalUserInfo: (
userCredential: UserCredential
) => AdditionalUserInfo | null;
  • Extracts provider specific AdditionalUserInfo for the given credential.

    Parameter userCredential

    The user credential.

    Modifiers

    • @public

function getAuth

getAuth: (app?: FirebaseApp) => Auth;
  • Returns the Auth instance associated with the provided @firebase/app#FirebaseApp. If no instance exists, initializes an Auth instance with platform-specific default dependencies.

    Parameter app

    The Firebase App.

    Modifiers

    • @public

function getIdToken

getIdToken: (user: User, forceRefresh?: boolean) => Promise<string>;
  • Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.

    Parameter user

    The user.

    Parameter forceRefresh

    Force refresh regardless of token expiration.

    Remarks

    Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.

    Modifiers

    • @public

function getIdTokenResult

getIdTokenResult: (user: User, forceRefresh?: boolean) => Promise<IdTokenResult>;
  • Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.

    Parameter user

    The user.

    Parameter forceRefresh

    Force refresh regardless of token expiration.

    Remarks

    Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.

    Modifiers

    • @public

function getMultiFactorResolver

getMultiFactorResolver: (
auth: Auth,
error: MultiFactorError
) => MultiFactorResolver;
  • Provides a MultiFactorResolver suitable for completion of a multi-factor flow.

    Parameter auth

    The Auth instance.

    Parameter error

    The MultiFactorError raised during a sign-in, or reauthentication operation.

    Modifiers

    • @public

function getRedirectResult

getRedirectResult: (
auth: Auth,
resolver?: PopupRedirectResolver
) => Promise<UserCredential | null>;
  • Returns a UserCredential from the redirect-based sign-in flow.

    Parameter auth

    The Auth instance.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an error. If no redirect operation was called, returns null.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using a redirect.
    const provider = new FacebookAuthProvider();
    // You can add additional scopes to the provider:
    provider.addScope('user_birthday');
    // Start a sign in process for an unauthenticated user.
    await signInWithRedirect(auth, provider);
    // This will trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);
    if (result) {
    // This is the signed-in user
    const user = result.user;
    // This gives you a Facebook Access Token.
    const credential = provider.credentialFromResult(auth, result);
    const token = credential.accessToken;
    }
    // As this API can be used for sign-in, linking and reauthentication,
    // check the operationType to determine what triggered this redirect
    // operation.
    const operationType = result.operationType;

    Modifiers

    • @public

function initializeAuth

initializeAuth: (app: FirebaseApp, deps?: Dependencies) => Auth;
  • Initializes an Auth instance with fine-grained control over Dependencies.

    Remarks

    This function allows more control over the Auth instance than getAuth. getAuth uses platform-specific defaults to supply the Dependencies. In general, getAuth is the easiest way to initialize Auth and works for most use cases. Use initializeAuth if you need control over which persistence layer is used, or to minimize bundle size if you're not using either signInWithPopup or signInWithRedirect.

    For example, if your app only uses anonymous accounts and you only want accounts saved for the current session, initialize Auth with:

    const auth = initializeAuth(app, {
    persistence: browserSessionPersistence,
    popupRedirectResolver: undefined,
    });

    Modifiers

    • @public

function initializeRecaptchaConfig

initializeRecaptchaConfig: (auth: Auth) => Promise<void>;
  • Loads the reCAPTCHA configuration into the Auth instance.

    Parameter auth

    The Auth instance.

    Remarks

    This will load the reCAPTCHA config, which indicates whether the reCAPTCHA verification flow should be triggered for each auth provider, into the current Auth session.

    If initializeRecaptchaConfig() is not invoked, the auth flow will always start without reCAPTCHA verification. If the provider is configured to require reCAPTCHA verification, the SDK will transparently load the reCAPTCHA config and restart the auth flows.

    Thus, by calling this optional method, you will reduce the latency of future auth flows. Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.

    This method does not work in a Node.js environment.

    Example 1

    initializeRecaptchaConfig(auth);

    Modifiers

    • @public
isSignInWithEmailLink: (auth: Auth, emailLink: string) => boolean;
  • Checks if an incoming link is a sign-in with email link suitable for signInWithEmailLink.

    Parameter auth

    The Auth instance.

    Parameter emailLink

    The link sent to the user's email address.

    Modifiers

    • @public

function linkWithCredential

linkWithCredential: (
user: User,
credential: AuthCredential
) => Promise<UserCredential>;
  • Links the user account with the given credentials.

    Parameter user

    The user.

    Parameter credential

    The auth credential.

    Remarks

    An AuthProvider can be used to generate the credential.

    Modifiers

    • @public

function linkWithPhoneNumber

linkWithPhoneNumber: (
user: User,
phoneNumber: string,
appVerifier: ApplicationVerifier
) => Promise<ConfirmationResult>;
  • Links the user account with the given phone number.

    Parameter user

    The user.

    Parameter phoneNumber

    The user's phone number in E.164 format (e.g. +16505550101).

    Parameter appVerifier

    The ApplicationVerifier.

    Remarks

    This method does not work in a Node.js environment.

    Modifiers

    • @public

function linkWithPopup

linkWithPopup: (
user: User,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<UserCredential>;
  • Links the authenticated provider to the user account using a pop-up based OAuth flow.

    Parameter user

    The user.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    If the linking is successful, the returned result will contain the user and the provider's credential.

    This method does not work in a Node.js environment.

    Example 1

    // Sign in using some other provider.
    const result = await signInWithEmailAndPassword(auth, email, password);
    // Link using a popup.
    const provider = new FacebookAuthProvider();
    await linkWithPopup(result.user, provider);

    Modifiers

    • @public

function linkWithRedirect

linkWithRedirect: (
user: User,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<never>;
  • Links the OAuthProvider to the user account using a full-page redirect flow.

    Parameter user

    The user.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    To handle the results and errors for this operation, refer to getRedirectResult. Follow the best practices when using linkWithRedirect.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using some other provider.
    const result = await signInWithEmailAndPassword(auth, email, password);
    // Link using a redirect.
    const provider = new FacebookAuthProvider();
    await linkWithRedirect(result.user, provider);
    // This will trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);

    Modifiers

    • @public

function multiFactor

multiFactor: (user: User) => MultiFactorUser;
  • The MultiFactorUser corresponding to the user.

    Parameter user

    The user.

    Remarks

    This is used to access all multi-factor properties and operations related to the user.

    Modifiers

    • @public

function onAuthStateChanged

onAuthStateChanged: (
auth: Auth,
nextOrObserver: NextOrObserver<User>,
error?: ErrorFn,
completed?: CompleteFn
) => Unsubscribe;
  • Adds an observer for changes to the user's sign-in state.

    Parameter auth

    The Auth instance.

    Parameter nextOrObserver

    callback triggered on change.

    Parameter error

    Deprecated. This callback is never triggered. Errors on signing in/out can be caught in promises returned from sign-in/sign-out functions.

    Parameter completed

    Deprecated. This callback is never triggered.

    Remarks

    To keep the old behavior, see onIdTokenChanged.

    Modifiers

    • @public

function onIdTokenChanged

onIdTokenChanged: (
auth: Auth,
nextOrObserver: NextOrObserver<User>,
error?: ErrorFn,
completed?: CompleteFn
) => Unsubscribe;
  • Adds an observer for changes to the signed-in user's ID token.

    Parameter auth

    The Auth instance.

    Parameter nextOrObserver

    callback triggered on change.

    Parameter error

    Deprecated. This callback is never triggered. Errors on signing in/out can be caught in promises returned from sign-in/sign-out functions.

    Parameter completed

    Deprecated. This callback is never triggered.

    Remarks

    This includes sign-in, sign-out, and token refresh events. This will not be triggered automatically upon ID token expiration. Use User.getIdToken to refresh the ID token.

    Modifiers

    • @public

function parseActionCodeURL

parseActionCodeURL: (link: string) => ActionCodeURL | null;
  • Parses the email action link string and returns an ActionCodeURL if the link is valid, otherwise returns null.

    Modifiers

    • @public

function reauthenticateWithCredential

reauthenticateWithCredential: (
user: User,
credential: AuthCredential
) => Promise<UserCredential>;
  • Re-authenticates a user using a fresh credential.

    Parameter user

    The user.

    Parameter credential

    The auth credential.

    Remarks

    Use before operations such as updatePassword that require tokens from recent sign-in attempts. This method can be used to recover from a CREDENTIAL_TOO_OLD_LOGIN_AGAIN error or a TOKEN_EXPIRED error.

    This method is not supported on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function reauthenticateWithPhoneNumber

reauthenticateWithPhoneNumber: (
user: User,
phoneNumber: string,
appVerifier: ApplicationVerifier
) => Promise<ConfirmationResult>;
  • Re-authenticates a user using a fresh phone credential.

    Parameter user

    The user.

    Parameter phoneNumber

    The user's phone number in E.164 format (e.g. +16505550101).

    Parameter appVerifier

    The ApplicationVerifier.

    Remarks

    Use before operations such as updatePassword that require tokens from recent sign-in attempts.

    This method does not work in a Node.js environment or on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function reauthenticateWithPopup

reauthenticateWithPopup: (
user: User,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<UserCredential>;
  • Reauthenticates the current user with the specified OAuthProvider using a pop-up based OAuth flow.

    Parameter user

    The user.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    If the reauthentication is successful, the returned result will contain the user and the provider's credential.

    This method does not work in a Node.js environment or on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using a popup.
    const provider = new FacebookAuthProvider();
    const result = await signInWithPopup(auth, provider);
    // Reauthenticate using a popup.
    await reauthenticateWithPopup(result.user, provider);

    Modifiers

    • @public

function reauthenticateWithRedirect

reauthenticateWithRedirect: (
user: User,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<never>;
  • Reauthenticates the current user with the specified OAuthProvider using a full-page redirect flow.

    Parameter user

    The user.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    To handle the results and errors for this operation, refer to getRedirectResult. Follow the best practices when using reauthenticateWithRedirect.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using a redirect.
    const provider = new FacebookAuthProvider();
    const result = await signInWithRedirect(auth, provider);
    // This will trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);
    // Reauthenticate using a redirect.
    await reauthenticateWithRedirect(result.user, provider);
    // This will again trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);

    Modifiers

    • @public

function reload

reload: (user: User) => Promise<void>;
  • Reloads user account data, if signed in.

    Parameter user

    The user.

    Modifiers

    • @public

function revokeAccessToken

revokeAccessToken: (auth: Auth, token: string) => Promise<void>;
  • Revokes the given access token. Currently only supports Apple OAuth access tokens.

    Parameter auth

    The Auth instance.

    Parameter token

    The Apple OAuth access token.

    Modifiers

    • @public

function sendEmailVerification

sendEmailVerification: (
user: User,
actionCodeSettings?: ActionCodeSettings | null
) => Promise<void>;
  • Sends a verification email to a user.

    Parameter user

    The user.

    Parameter actionCodeSettings

    The ActionCodeSettings.

    Remarks

    The verification process is completed by calling applyActionCode.

    Example 1

    const actionCodeSettings = {
    url: 'https://www.example.com/?email=user@example.com',
    iOS: {
    bundleId: 'com.example.ios'
    },
    android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
    },
    handleCodeInApp: true
    };
    await sendEmailVerification(user, actionCodeSettings);
    // Obtain code from the user.
    await applyActionCode(auth, code);

    Modifiers

    • @public

function sendPasswordResetEmail

sendPasswordResetEmail: (
auth: Auth,
email: string,
actionCodeSettings?: ActionCodeSettings
) => Promise<void>;
  • Sends a password reset email to the given email address. This method does not throw an error when there's no user account with the given email address and [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.

    Parameter auth

    The Auth instance.

    Parameter email

    The user's email address.

    Parameter actionCodeSettings

    The ActionCodeSettings.

    Remarks

    To complete the password reset, call confirmPasswordReset with the code supplied in the email sent to the user, along with the new password specified by the user.

    Example 1

    const actionCodeSettings = {
    url: 'https://www.example.com/?email=user@example.com',
    iOS: {
    bundleId: 'com.example.ios'
    },
    android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
    },
    handleCodeInApp: true
    };
    await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);
    // Obtain code from user.
    await confirmPasswordReset('user@example.com', code);

    Modifiers

    • @public

function sendSignInLinkToEmail

sendSignInLinkToEmail: (
auth: Auth,
email: string,
actionCodeSettings: ActionCodeSettings
) => Promise<void>;
  • Sends a sign-in email link to the user with the specified email.

    Parameter authInternal

    The Auth instance.

    Parameter email

    The user's email address.

    Parameter actionCodeSettings

    The ActionCodeSettings.

    Remarks

    The sign-in operation has to always be completed in the app unlike other out of band email actions (password reset and email verifications). This is because, at the end of the flow, the user is expected to be signed in and their Auth state persisted within the app.

    To complete sign in with the email link, call signInWithEmailLink with the email address and the email link supplied in the email sent to the user.

    Example 1

    const actionCodeSettings = {
    url: 'https://www.example.com/?email=user@example.com',
    iOS: {
    bundleId: 'com.example.ios'
    },
    android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
    },
    handleCodeInApp: true
    };
    await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
    // Obtain emailLink from the user.
    if(isSignInWithEmailLink(auth, emailLink)) {
    await signInWithEmailLink(auth, 'user@example.com', emailLink);
    }

    Modifiers

    • @public

function setPersistence

setPersistence: (auth: Auth, persistence: Persistence) => Promise<void>;
  • 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.

    Parameter auth

    The Auth instance.

    Parameter persistence

    The Persistence to use.

    Returns

    A Promise that resolves once the persistence change has completed

    Remarks

    This makes it easy for a user signing in to specify whether their session should be remembered or not. It also makes it easier to never persist the Auth state for applications that are shared by other users or have sensitive data.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    setPersistence(auth, browserSessionPersistence);

    Modifiers

    • @public

function signInAnonymously

signInAnonymously: (auth: Auth) => Promise<UserCredential>;
  • Asynchronously signs in as an anonymous user.

    Parameter auth

    The Auth instance.

    Remarks

    If there is already an anonymous user signed in, that user will be returned; otherwise, a new anonymous user identity will be created and returned.

    This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function signInWithCredential

signInWithCredential: (
auth: Auth,
credential: AuthCredential
) => Promise<UserCredential>;
  • Asynchronously signs in with the given credentials.

    Parameter auth

    The Auth instance.

    Parameter credential

    The auth credential.

    Remarks

    An AuthProvider can be used to generate the credential.

    This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function signInWithCustomToken

signInWithCustomToken: (
auth: Auth,
customToken: string
) => Promise<UserCredential>;
  • Asynchronously signs in using a custom token.

    Parameter auth

    The Auth instance.

    Parameter customToken

    The custom token to sign in with.

    Remarks

    Custom tokens are used to integrate Firebase Auth with existing auth systems, and must be generated by an auth backend using the createCustomToken method in the Admin SDK .

    Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.

    This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function signInWithEmailAndPassword

signInWithEmailAndPassword: (
auth: Auth,
email: string,
password: string
) => Promise<UserCredential>;
  • Asynchronously signs in using an email and password.

    Parameter auth

    The Auth instance.

    Parameter email

    The users email address.

    Parameter password

    The users password.

    Remarks

    Fails with an error if the email address and password do not match. When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, this method fails with "auth/invalid-credential" in case of an invalid email/password.

    This method is not supported on Auth instances created with a @firebase/app#FirebaseServerApp.

    Note: The user's password is NOT the password used to access the user's email account. The email address serves as a unique identifier for the user, and the password is used to access the user's account in your Firebase project. See also: createUserWithEmailAndPassword.

    Modifiers

    • @public
signInWithEmailLink: (
auth: Auth,
email: string,
emailLink?: string
) => Promise<UserCredential>;
  • Asynchronously signs in using an email and sign-in email link.

    Parameter auth

    The Auth instance.

    Parameter email

    The user's email address.

    Parameter emailLink

    The link sent to the user's email address.

    Remarks

    If no link is passed, the link is inferred from the current URL.

    Fails with an error if the email address is invalid or OTP in email link expires.

    This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

    Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.

    Example 1

    const actionCodeSettings = {
    url: 'https://www.example.com/?email=user@example.com',
    iOS: {
    bundleId: 'com.example.ios'
    },
    android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
    },
    handleCodeInApp: true
    };
    await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
    // Obtain emailLink from the user.
    if(isSignInWithEmailLink(auth, emailLink)) {
    await signInWithEmailLink(auth, 'user@example.com', emailLink);
    }

    Modifiers

    • @public

function signInWithPhoneNumber

signInWithPhoneNumber: (
auth: Auth,
phoneNumber: string,
appVerifier: ApplicationVerifier
) => Promise<ConfirmationResult>;
  • Asynchronously signs in using a phone number.

    Parameter auth

    The Auth instance.

    Parameter phoneNumber

    The user's phone number in E.164 format (e.g. +16505550101).

    Parameter appVerifier

    The ApplicationVerifier.

    Remarks

    This method sends a code via SMS to the given phone number, and returns a ConfirmationResult. After the user provides the code sent to their phone, call ConfirmationResult.confirm with the code to sign the user in.

    For abuse prevention, this method also requires a ApplicationVerifier. This SDK includes a reCAPTCHA-based implementation, RecaptchaVerifier. This function can work on other platforms that do not support the RecaptchaVerifier (like React Native), but you need to use a third-party ApplicationVerifier implementation.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // 'recaptcha-container' is the ID of an element in the DOM.
    const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
    const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
    // Obtain a verificationCode from the user.
    const credential = await confirmationResult.confirm(verificationCode);

    Modifiers

    • @public

function signInWithPopup

signInWithPopup: (
auth: Auth,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<UserCredential>;
  • Authenticates a Firebase client using a popup-based OAuth authentication flow.

    Parameter auth

    The Auth instance.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    If succeeds, returns the signed in user along with the provider's credential. If sign in was unsuccessful, returns an error object containing additional information about the error.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using a popup.
    const provider = new FacebookAuthProvider();
    const result = await signInWithPopup(auth, provider);
    // The signed-in user info.
    const user = result.user;
    // This gives you a Facebook Access Token.
    const credential = provider.credentialFromResult(auth, result);
    const token = credential.accessToken;

    Modifiers

    • @public

function signInWithRedirect

signInWithRedirect: (
auth: Auth,
provider: AuthProvider,
resolver?: PopupRedirectResolver
) => Promise<never>;
  • Authenticates a Firebase client using a full-page redirect flow.

    Parameter auth

    The Auth instance.

    Parameter provider

    The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error.

    Parameter resolver

    An instance of PopupRedirectResolver, optional if already supplied to initializeAuth or provided by getAuth.

    Remarks

    To handle the results and errors for this operation, refer to getRedirectResult. Follow the best practices when using signInWithRedirect.

    This method does not work in a Node.js environment or with Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // Sign in using a redirect.
    const provider = new FacebookAuthProvider();
    // You can add additional scopes to the provider:
    provider.addScope('user_birthday');
    // Start a sign in process for an unauthenticated user.
    await signInWithRedirect(auth, provider);
    // This will trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);
    if (result) {
    // This is the signed-in user
    const user = result.user;
    // This gives you a Facebook Access Token.
    const credential = provider.credentialFromResult(auth, result);
    const token = credential.accessToken;
    }
    // As this API can be used for sign-in, linking and reauthentication,
    // check the operationType to determine what triggered this redirect
    // operation.
    const operationType = result.operationType;

    Modifiers

    • @public

function signOut

signOut: (auth: Auth) => Promise<void>;
unlink: (user: User, providerId: string) => Promise<User>;
  • Unlinks a provider from a user account.

    Parameter user

    The user.

    Parameter providerId

    The provider to unlink.

    Modifiers

    • @public

function updateCurrentUser

updateCurrentUser: (auth: Auth, user: User | null) => Promise<void>;
  • Asynchronously sets the provided user as Auth.currentUser on the Auth instance.

    Parameter auth

    The Auth instance.

    Parameter user

    The new User.

    Remarks

    A new instance copy of the user provided will be made and set as currentUser.

    This will trigger onAuthStateChanged and onIdTokenChanged listeners like other sign in methods.

    The operation fails with an error if the user to be updated belongs to a different Firebase project.

    This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

    Modifiers

    • @public

function updateEmail

updateEmail: (user: User, newEmail: string) => Promise<void>;
  • Updates the user's email address.

    Parameter user

    The user.

    Parameter newEmail

    The new email address.

    Throws "auth/operation-not-allowed" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled. Deprecated - Use verifyBeforeUpdateEmail instead.

    Remarks

    An email will be sent to the original email address (if it was set) that allows to revoke the email address change, in order to protect them from account hijacking.

    This method is not supported on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

    Important: this is a security sensitive operation that requires the user to have recently signed in. If this requirement isn't met, ask the user to authenticate again and then call reauthenticateWithCredential.

    Modifiers

    • @public

function updatePassword

updatePassword: (user: User, newPassword: string) => Promise<void>;
  • Updates the user's password.

    Parameter user

    The user.

    Parameter newPassword

    The new password.

    Remarks

    Important: this is a security sensitive operation that requires the user to have recently signed in. If this requirement isn't met, ask the user to authenticate again and then call reauthenticateWithCredential.

    Modifiers

    • @public

function updatePhoneNumber

updatePhoneNumber: (
user: User,
credential: PhoneAuthCredential
) => Promise<void>;
  • Updates the user's phone number.

    Parameter user

    The user.

    Parameter credential

    A credential authenticating the new phone number.

    Remarks

    This method does not work in a Node.js environment or on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

    Example 1

    // 'recaptcha-container' is the ID of an element in the DOM.
    const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
    const provider = new PhoneAuthProvider(auth);
    const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
    // Obtain the verificationCode from the user.
    const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
    await updatePhoneNumber(user, phoneCredential);

    Modifiers

    • @public

function updateProfile

updateProfile: (
user: User,
{
displayName,
photoURL: photoUrl,
}: { displayName?: string | null; photoURL?: string | null }
) => Promise<void>;
  • Updates a user's profile data.

    Parameter user

    The user.

    Parameter profile

    The profile's displayName and photoURL to update.

    Modifiers

    • @public

function useDeviceLanguage

useDeviceLanguage: (auth: Auth) => void;
  • Sets the current language to the default device/browser preference.

    Parameter auth

    The Auth instance.

    Modifiers

    • @public

function validatePassword

validatePassword: (
auth: Auth,
password: string
) => Promise<PasswordValidationStatus>;
  • Validates the password against the password policy configured for the project or tenant.

    Parameter auth

    The Auth instance.

    Parameter password

    The password to validate.

    Remarks

    If no tenant ID is set on the Auth instance, then this method will use the password policy configured for the project. Otherwise, this method will use the policy configured for the tenant. If a password policy has not been configured, then the default policy configured for all projects will be used.

    If an auth flow fails because a submitted password does not meet the password policy requirements and this method has previously been called, then this method will use the most recent policy available when called again.

    Example 1

    validatePassword(auth, 'some-password');

    Modifiers

    • @public

function verifyBeforeUpdateEmail

verifyBeforeUpdateEmail: (
user: User,
newEmail: string,
actionCodeSettings?: ActionCodeSettings | null
) => Promise<void>;
  • Sends a verification email to a new email address.

    Parameter user

    The user.

    Parameter newEmail

    The new email address to be verified before update.

    Parameter actionCodeSettings

    The ActionCodeSettings.

    Remarks

    The user's email will be updated to the new one after being verified.

    If you have a custom email action handler, you can complete the verification process by calling applyActionCode.

    Example 1

    const actionCodeSettings = {
    url: 'https://www.example.com/?email=user@example.com',
    iOS: {
    bundleId: 'com.example.ios'
    },
    android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
    },
    handleCodeInApp: true
    };
    await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
    // Obtain code from the user.
    await applyActionCode(auth, code);

    Modifiers

    • @public

function verifyPasswordResetCode

verifyPasswordResetCode: (auth: Auth, code: string) => Promise<string>;
  • Checks a password reset code sent to the user by email or other out-of-band mechanism.

    Parameter auth

    The Auth instance.

    Parameter code

    A verification code sent to the user.

    Returns

    the user's email address if valid.

    Modifiers

    • @public

Classes

class ActionCodeURL

class ActionCodeURL {}
  • A utility class to parse email action URLs such as password reset, email verification, email link sign in, etc.

    Modifiers

    • @public

property apiKey

readonly apiKey: string;
  • The API key of the email action link.

property code

readonly code: string;
  • The action code of the email action link.

property continueUrl

readonly continueUrl: string;
  • The continue URL of the email action link. Null if not provided.

property languageCode

readonly languageCode: string;
  • The language code of the email action link. Null if not provided.

property operation

readonly operation: string;
  • The action performed by the email action link. It returns from one of the types from ActionCodeInfo

property tenantId

readonly tenantId: string;
  • The tenant ID of the email action link. Null if the email action is from the parent project.

static parseLink: (link: string) => ActionCodeURL | null;
  • Parses the email action link string and returns an ActionCodeURL if the link is valid, otherwise returns null.

    Parameter link

    The email action link string.

    Returns

    The ActionCodeURL object, or null if the link is invalid.

    Modifiers

    • @public

class AuthCredential

class AuthCredential {}
  • Interface that represents the credentials returned by an AuthProvider.

    Remarks

    Implementations specify the details about each auth provider's credential requirements.

    Modifiers

    • @public

property providerId

readonly providerId: string;
  • The authentication provider ID for the credential.

    Remarks

    For example, 'facebook.com', or 'google.com'.

property signInMethod

readonly signInMethod: string;

method toJSON

toJSON: () => object;
  • Returns a JSON-serializable representation of this object.

    Returns

    a JSON-serializable representation of this object.

class EmailAuthCredential

class EmailAuthCredential extends AuthCredential {}

method fromJSON

static fromJSON: (json: object | string) => EmailAuthCredential | null;
  • Static method to deserialize a JSON representation of an object into an AuthCredential.

    Parameter json

    Either object or the stringified representation of the object. When string is provided, JSON.parse would be called first.

    Returns

    If the JSON input does not represent an AuthCredential, null is returned.

method toJSON

toJSON: () => object;

class EmailAuthProvider

class EmailAuthProvider implements AuthProvider {}
static readonly EMAIL_LINK_SIGN_IN_METHOD: string;

property EMAIL_PASSWORD_SIGN_IN_METHOD

static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: string;

property PROVIDER_ID

static readonly PROVIDER_ID: string;
  • Always set to ProviderId.PASSWORD, even for email link.

property providerId

readonly providerId: string;
  • Always set to ProviderId.PASSWORD, even for email link.

method credential

static credential: (email: string, password: string) => EmailAuthCredential;
  • Initialize an AuthCredential using an email and password.

    Parameter email

    Email address.

    Parameter password

    User account password.

    Returns

    The auth provider credential.

    Example 1

    const authCredential = EmailAuthProvider.credential(email, password);
    const userCredential = await signInWithCredential(auth, authCredential);

    Example 2

    const userCredential = await signInWithEmailAndPassword(auth, email, password);

static credentialWithLink: (
email: string,
emailLink: string
) => EmailAuthCredential;
  • Initialize an AuthCredential using an email and an email link after a sign in with email link operation.

    Parameter auth

    The Auth instance used to verify the link.

    Parameter email

    Email address.

    Parameter emailLink

    Sign-in email link.

    Returns

    - The auth provider credential.

    Example 1

    const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
    const userCredential = await signInWithCredential(auth, authCredential);

    Example 2

    await sendSignInLinkToEmail(auth, email);
    // Obtain emailLink from user.
    const userCredential = await signInWithEmailLink(auth, email, emailLink);

class FacebookAuthProvider

class FacebookAuthProvider extends BaseOAuthProvider {}
  • Provider for generating an OAuthCredential for ProviderId.FACEBOOK.

    Example 1

    // Sign in using a redirect.
    const provider = new FacebookAuthProvider();
    // Start a sign in process for an unauthenticated user.
    provider.addScope('user_birthday');
    await signInWithRedirect(auth, provider);
    // This will trigger a full page redirect away from your app
    // After returning from the redirect when your app initializes you can obtain the result
    const result = await getRedirectResult(auth);
    if (result) {
    // This is the signed-in user
    const user = result.user;
    // This gives you a Facebook Access Token.
    const credential = FacebookAuthProvider.credentialFromResult(result);
    const token = credential.accessToken;
    }

    Example 2

    // Sign in using a popup.
    const provider = new FacebookAuthProvider();
    provider.addScope('user_birthday');
    const result = await signInWithPopup(auth, provider);
    // The signed-in user info.
    const user = result.user;
    // This gives you a Facebook Access Token.
    const credential = FacebookAuthProvider.credentialFromResult(result);
    const token = credential.accessToken;

    Modifiers

    • @public

constructor

constructor();

    property FACEBOOK_SIGN_IN_METHOD

    static readonly FACEBOOK_SIGN_IN_METHOD: string;

    property PROVIDER_ID

    static readonly PROVIDER_ID: string;

    method credential

    static credential: (accessToken: string) => OAuthCredential;
    • Creates a credential for Facebook.

      Parameter accessToken

      Facebook access token.

      Example 1

      // `event` from the Facebook auth.authResponseChange callback.
      const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
      const result = await signInWithCredential(credential);

    method credentialFromError

    static credentialFromError: (error: FirebaseError) => OAuthCredential | null;
    • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

      Parameter userCredential

      The user credential.

    method credentialFromResult

    static credentialFromResult: (
    userCredential: UserCredential
    ) => OAuthCredential | null;

    class GithubAuthProvider

    class GithubAuthProvider extends BaseOAuthProvider {}
    • Provider for generating an OAuthCredential for ProviderId.GITHUB.

      Remarks

      GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use the signInWithPopup handler:

      Example 1

      // Sign in using a redirect.
      const provider = new GithubAuthProvider();
      // Start a sign in process for an unauthenticated user.
      provider.addScope('repo');
      await signInWithRedirect(auth, provider);
      // This will trigger a full page redirect away from your app
      // After returning from the redirect when your app initializes you can obtain the result
      const result = await getRedirectResult(auth);
      if (result) {
      // This is the signed-in user
      const user = result.user;
      // This gives you a Github Access Token.
      const credential = GithubAuthProvider.credentialFromResult(result);
      const token = credential.accessToken;
      }

      Example 2

      // Sign in using a popup.
      const provider = new GithubAuthProvider();
      provider.addScope('repo');
      const result = await signInWithPopup(auth, provider);
      // The signed-in user info.
      const user = result.user;
      // This gives you a Github Access Token.
      const credential = GithubAuthProvider.credentialFromResult(result);
      const token = credential.accessToken;

      Modifiers

      • @public

    constructor

    constructor();

      property GITHUB_SIGN_IN_METHOD

      static readonly GITHUB_SIGN_IN_METHOD: string;

      property PROVIDER_ID

      static readonly PROVIDER_ID: string;

      method credential

      static credential: (accessToken: string) => OAuthCredential;
      • Creates a credential for Github.

        Parameter accessToken

        Github access token.

      method credentialFromError

      static credentialFromError: (error: FirebaseError) => OAuthCredential | null;
      • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

        Parameter userCredential

        The user credential.

      method credentialFromResult

      static credentialFromResult: (
      userCredential: UserCredential
      ) => OAuthCredential | null;

      class GoogleAuthProvider

      class GoogleAuthProvider extends BaseOAuthProvider {}
      • Provider for generating an OAuthCredential for ProviderId.GOOGLE.

        Example 1

        // Sign in using a redirect.
        const provider = new GoogleAuthProvider();
        // Start a sign in process for an unauthenticated user.
        provider.addScope('profile');
        provider.addScope('email');
        await signInWithRedirect(auth, provider);
        // This will trigger a full page redirect away from your app
        // After returning from the redirect when your app initializes you can obtain the result
        const result = await getRedirectResult(auth);
        if (result) {
        // This is the signed-in user
        const user = result.user;
        // This gives you a Google Access Token.
        const credential = GoogleAuthProvider.credentialFromResult(result);
        const token = credential.accessToken;
        }

        Example 2

        // Sign in using a popup.
        const provider = new GoogleAuthProvider();
        provider.addScope('profile');
        provider.addScope('email');
        const result = await signInWithPopup(auth, provider);
        // The signed-in user info.
        const user = result.user;
        // This gives you a Google Access Token.
        const credential = GoogleAuthProvider.credentialFromResult(result);
        const token = credential.accessToken;

        Modifiers

        • @public

      constructor

      constructor();

        property GOOGLE_SIGN_IN_METHOD

        static readonly GOOGLE_SIGN_IN_METHOD: string;

        property PROVIDER_ID

        static readonly PROVIDER_ID: string;

        method credential

        static credential: (
        idToken?: string | null,
        accessToken?: string | null
        ) => OAuthCredential;
        • Creates a credential for Google. At least one of ID token and access token is required.

          Parameter idToken

          Google ID token.

          Parameter accessToken

          Google access token.

          Example 1

          // \`googleUser\` from the onsuccess Google Sign In callback.
          const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
          const result = await signInWithCredential(credential);

        method credentialFromError

        static credentialFromError: (error: FirebaseError) => OAuthCredential | null;
        • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

          Parameter userCredential

          The user credential.

        method credentialFromResult

        static credentialFromResult: (
        userCredential: UserCredential
        ) => OAuthCredential | null;

        class OAuthCredential

        class OAuthCredential extends AuthCredential {}
        • Represents the OAuth credentials returned by an OAuthProvider.

          Remarks

          Implementations specify the details about each auth provider's credential requirements.

          Modifiers

          • @public

        property accessToken

        accessToken?: string;
        • The OAuth access token associated with the credential if it belongs to an OAuthProvider, such as facebook.com, twitter.com, etc.

          Modifiers

          • @readonly

        property idToken

        idToken?: string;
        • The OAuth ID token associated with the credential if it belongs to an OIDC provider, such as google.com.

          Modifiers

          • @readonly

        property secret

        secret?: string;
        • The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0 provider, such as twitter.com.

          Modifiers

          • @readonly

        method fromJSON

        static fromJSON: (json: string | object) => OAuthCredential | null;
        • Static method to deserialize a JSON representation of an object into an AuthCredential.

          Parameter json

          Input can be either Object or the stringified representation of the object. When string is provided, JSON.parse would be called first.

          Returns

          If the JSON input does not represent an AuthCredential, null is returned.

        method toJSON

        toJSON: () => object;

        class OAuthProvider

        class OAuthProvider extends BaseOAuthProvider {}
        • Provider for generating generic OAuthCredential.

          Example 1

          // Sign in using a redirect.
          const provider = new OAuthProvider('google.com');
          // Start a sign in process for an unauthenticated user.
          provider.addScope('profile');
          provider.addScope('email');
          await signInWithRedirect(auth, provider);
          // This will trigger a full page redirect away from your app
          // After returning from the redirect when your app initializes you can obtain the result
          const result = await getRedirectResult(auth);
          if (result) {
          // This is the signed-in user
          const user = result.user;
          // This gives you a OAuth Access Token for the provider.
          const credential = provider.credentialFromResult(auth, result);
          const token = credential.accessToken;
          }

          Example 2

          // Sign in using a popup.
          const provider = new OAuthProvider('google.com');
          provider.addScope('profile');
          provider.addScope('email');
          const result = await signInWithPopup(auth, provider);
          // The signed-in user info.
          const user = result.user;
          // This gives you a OAuth Access Token for the provider.
          const credential = provider.credentialFromResult(auth, result);
          const token = credential.accessToken;

          Modifiers

          • @public

        method credential

        credential: (params: OAuthCredentialOptions) => OAuthCredential;
        • Creates a OAuthCredential from a generic OAuth provider's access token or ID token.

          Parameter params

          Either the options object containing the ID token, access token and raw nonce or the ID token string.

          Remarks

          The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of the raw nonce must match the nonce field in the ID token.

          Example 1

          // `googleUser` from the onsuccess Google Sign In callback.
          // Initialize a generate OAuth provider with a `google.com` providerId.
          const provider = new OAuthProvider('google.com');
          const credential = provider.credential({
          idToken: googleUser.getAuthResponse().id_token,
          });
          const result = await signInWithCredential(credential);

        method credentialFromError

        static credentialFromError: (error: FirebaseError) => OAuthCredential | null;
        • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

          Parameter userCredential

          The user credential.

        method credentialFromJSON

        static credentialFromJSON: (json: object | string) => OAuthCredential;
        • Creates an OAuthCredential from a JSON string or a plain object.

          Parameter json

          A plain object or a JSON string

        method credentialFromResult

        static credentialFromResult: (
        userCredential: UserCredential
        ) => OAuthCredential | null;

        class PhoneAuthCredential

        class PhoneAuthCredential extends AuthCredential {}

        method fromJSON

        static fromJSON: (json: object | string) => PhoneAuthCredential | null;
        • Generates a phone credential based on a plain object or a JSON string.

        method toJSON

        toJSON: () => object;

        class PhoneAuthProvider

        class PhoneAuthProvider {}
        • Provider for generating an PhoneAuthCredential.

          Remarks

          PhoneAuthProvider does not work in a Node.js environment.

          Example 1

          // 'recaptcha-container' is the ID of an element in the DOM.
          const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
          const provider = new PhoneAuthProvider(auth);
          const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
          // Obtain the verificationCode from the user.
          const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
          const userCredential = await signInWithCredential(auth, phoneCredential);

          Modifiers

          • @public

        constructor

        constructor(auth: Auth);
        • Parameter auth

          The Firebase Auth instance in which sign-ins should occur.

        property PHONE_SIGN_IN_METHOD

        static readonly PHONE_SIGN_IN_METHOD: string;

        property PROVIDER_ID

        static readonly PROVIDER_ID: string;

        property providerId

        readonly providerId: string;

        method credential

        static credential: (
        verificationId: string,
        verificationCode: string
        ) => PhoneAuthCredential;
        • Creates a phone auth credential, given the verification ID from PhoneAuthProvider.verifyPhoneNumber and the code that was sent to the user's mobile device.

          Parameter verificationId

          The verification ID returned from PhoneAuthProvider.verifyPhoneNumber.

          Parameter verificationCode

          The verification code sent to the user's mobile device.

          Returns

          The auth provider credential.

          Example 1

          const provider = new PhoneAuthProvider(auth);
          const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
          // Obtain verificationCode from the user.
          const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
          const userCredential = signInWithCredential(auth, authCredential);

          Example 2

          An alternative flow is provided using the signInWithPhoneNumber method.

          const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
          // Obtain verificationCode from the user.
          const userCredential = await confirmationResult.confirm(verificationCode);

        method credentialFromError

        static credentialFromError: (error: FirebaseError) => AuthCredential | null;
        • Returns an AuthCredential when passed an error.

          Parameter error

          The error to generate a credential from.

          Remarks

          This method works for errors like auth/account-exists-with-different-credentials. This is useful for recovering when attempting to set a user's phone number but the number in question is already tied to another account. For example, the following code tries to update the current user's phone number, and if that fails, links the user with the account associated with that number:

          const provider = new PhoneAuthProvider(auth);
          const verificationId = await provider.verifyPhoneNumber(number, verifier);
          try {
          const code = ''; // Prompt the user for the verification code
          await updatePhoneNumber(
          auth.currentUser,
          PhoneAuthProvider.credential(verificationId, code));
          } catch (e) {
          if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {
          const cred = PhoneAuthProvider.credentialFromError(e);
          await linkWithCredential(auth.currentUser, cred);
          }
          }
          // At this point, auth.currentUser.phoneNumber === number.

        method credentialFromResult

        static credentialFromResult: (
        userCredential: UserCredential
        ) => AuthCredential | null;

        method verifyPhoneNumber

        verifyPhoneNumber: (
        phoneOptions: PhoneInfoOptions | string,
        applicationVerifier: ApplicationVerifier
        ) => Promise<string>;
        • Starts a phone number authentication flow by sending a verification code to the given phone number.

          Parameter phoneInfoOptions

          The user's PhoneInfoOptions. The phone number should be in E.164 format (e.g. +16505550101).

          Parameter applicationVerifier

          For abuse prevention, this method also requires a ApplicationVerifier. This SDK includes a reCAPTCHA-based implementation, RecaptchaVerifier.

          Returns

          A Promise for a verification ID that can be passed to PhoneAuthProvider.credential to identify this flow..

          Example 1

          const provider = new PhoneAuthProvider(auth);
          const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
          // Obtain verificationCode from the user.
          const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
          const userCredential = await signInWithCredential(auth, authCredential);

          Example 2

          An alternative flow is provided using the signInWithPhoneNumber method.

          const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
          // Obtain verificationCode from the user.
          const userCredential = confirmationResult.confirm(verificationCode);

        class PhoneMultiFactorGenerator

        class PhoneMultiFactorGenerator {}

        property FACTOR_ID

        static FACTOR_ID: string;
        • The identifier of the phone second factor: phone.

        method assertion

        static assertion: (credential: PhoneAuthCredential) => PhoneMultiFactorAssertion;

        class RecaptchaVerifier

        class RecaptchaVerifier implements ApplicationVerifierInternal {}
        • An reCAPTCHA-based application verifier.

          Remarks

          RecaptchaVerifier does not work in a Node.js environment.

          Modifiers

          • @public

        constructor

        constructor(
        authExtern: Auth,
        containerOrId: string | HTMLElement,
        parameters?: RecaptchaParameters
        );
        • Parameter authExtern

          The corresponding Firebase Auth instance.

          Parameter containerOrId

          The reCAPTCHA container parameter.

          Parameter parameters

          The optional reCAPTCHA parameters.

          Remarks

          Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value 'invisible'.

        property type

        readonly type: string;
        • The application verifier type.

          Remarks

          For a reCAPTCHA verifier, this is 'recaptcha'.

        method clear

        clear: () => void;
        • Clears the reCAPTCHA widget from the page and destroys the instance.

        method render

        render: () => Promise<number>;
        • Renders the reCAPTCHA widget on the page.

          Returns

          A Promise that resolves with the reCAPTCHA widget ID.

        method verify

        verify: () => Promise<string>;
        • Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.

          Returns

          A Promise for the reCAPTCHA token.

        class SAMLAuthProvider

        class SAMLAuthProvider extends FederatedAuthProvider {}

        constructor

        constructor(providerId: string);
        • Constructor. The providerId must start with "saml."

          Parameter providerId

          SAML provider ID.

        method credentialFromError

        static credentialFromError: (error: FirebaseError) => AuthCredential | null;
        • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

          Parameter userCredential

          The user credential.

        method credentialFromJSON

        static credentialFromJSON: (json: string | object) => AuthCredential;
        • Creates an AuthCredential from a JSON string or a plain object.

          Parameter json

          A plain object or a JSON string

        method credentialFromResult

        static credentialFromResult: (
        userCredential: UserCredential
        ) => AuthCredential | null;
        • Generates an AuthCredential from a UserCredential after a successful SAML flow completes.

          Parameter userCredential

          The user credential.

          Remarks

          For example, to get an AuthCredential, you could write the following code:

          const userCredential = await signInWithPopup(auth, samlProvider);
          const credential = SAMLAuthProvider.credentialFromResult(userCredential);

        class TotpMultiFactorGenerator

        class TotpMultiFactorGenerator {}

        property FACTOR_ID

        static FACTOR_ID: string;
        • The identifier of the TOTP second factor: totp.

        method assertionForEnrollment

        static assertionForEnrollment: (
        secret: TotpSecret,
        oneTimePassword: string
        ) => TotpMultiFactorAssertion;
        • Provides a TotpMultiFactorAssertion to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.

          Parameter secret

          A TotpSecret containing the shared secret key and other TOTP parameters.

          Parameter oneTimePassword

          One-time password from TOTP App.

          Returns

          A TotpMultiFactorAssertion which can be used with MultiFactorUser.enroll.

        method assertionForSignIn

        static assertionForSignIn: (
        enrollmentId: string,
        oneTimePassword: string
        ) => TotpMultiFactorAssertion;

        method generateSecret

        static generateSecret: (session: MultiFactorSession) => Promise<TotpSecret>;
        • Returns a promise to TotpSecret which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.

          Parameter session

          The MultiFactorSession that the user is part of.

          Returns

          A promise to TotpSecret.

        class TotpSecret

        class TotpSecret {}
        • Provider for generating a TotpMultiFactorAssertion.

          Stores the shared secret key and other parameters to generate time-based OTPs. Implements methods to retrieve the shared secret key and generate a QR code URL.

          Modifiers

          • @public

        property codeIntervalSeconds

        readonly codeIntervalSeconds: number;
        • The interval (in seconds) when the OTP codes should change.

        property codeLength

        readonly codeLength: number;
        • Length of the one-time passwords to be generated.

        property enrollmentCompletionDeadline

        readonly enrollmentCompletionDeadline: string;
        • The timestamp (UTC string) by which TOTP enrollment should be completed.

        property hashingAlgorithm

        readonly hashingAlgorithm: string;
        • Hashing algorithm used.

        property secretKey

        readonly secretKey: string;
        • Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.

        method generateQrCodeUrl

        generateQrCodeUrl: (accountName?: string, issuer?: string) => string;
        • Returns a QR code URL as described in https://github.com/google/google-authenticator/wiki/Key-Uri-Format This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. If the optional parameters are unspecified, an accountName of and issuer of are used.

          Parameter accountName

          the name of the account/app along with a user identifier.

          Parameter issuer

          issuer of the TOTP (likely the app name).

          Returns

          A QR code URL string.

        class TwitterAuthProvider

        class TwitterAuthProvider extends BaseOAuthProvider {}
        • Provider for generating an OAuthCredential for ProviderId.TWITTER.

          Example 1

          // Sign in using a redirect.
          const provider = new TwitterAuthProvider();
          // Start a sign in process for an unauthenticated user.
          await signInWithRedirect(auth, provider);
          // This will trigger a full page redirect away from your app
          // After returning from the redirect when your app initializes you can obtain the result
          const result = await getRedirectResult(auth);
          if (result) {
          // This is the signed-in user
          const user = result.user;
          // This gives you a Twitter Access Token and Secret.
          const credential = TwitterAuthProvider.credentialFromResult(result);
          const token = credential.accessToken;
          const secret = credential.secret;
          }

          Example 2

          // Sign in using a popup.
          const provider = new TwitterAuthProvider();
          const result = await signInWithPopup(auth, provider);
          // The signed-in user info.
          const user = result.user;
          // This gives you a Twitter Access Token and Secret.
          const credential = TwitterAuthProvider.credentialFromResult(result);
          const token = credential.accessToken;
          const secret = credential.secret;

          Modifiers

          • @public

        constructor

        constructor();

          property PROVIDER_ID

          static readonly PROVIDER_ID: string;

          property TWITTER_SIGN_IN_METHOD

          static readonly TWITTER_SIGN_IN_METHOD: string;

          method credential

          static credential: (token: string, secret: string) => OAuthCredential;
          • Creates a credential for Twitter.

            Parameter token

            Twitter access token.

            Parameter secret

            Twitter secret.

          method credentialFromError

          static credentialFromError: (error: FirebaseError) => OAuthCredential | null;
          • Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

            Parameter userCredential

            The user credential.

          method credentialFromResult

          static credentialFromResult: (
          userCredential: UserCredential
          ) => OAuthCredential | null;

          Interfaces

          interface ActionCodeInfo

          interface ActionCodeInfo {}

          property data

          data: {
          email?: string | null;
          multiFactorInfo?: MultiFactorInfo | null;
          previousEmail?: string | null;
          };
          • The data associated with the action code.

            Remarks

            For the ActionCodeOperation.PASSWORD_RESET, ActionCodeOperation.VERIFY_EMAIL, and ActionCodeOperation.RECOVER_EMAIL actions, this object contains an email field with the address the email was sent to.

            For the ActionCodeOperation.RECOVER_EMAIL action, which allows a user to undo an email address change, this object also contains a previousEmail field with the user account's current email address. After the action completes, the user's email address will revert to the value in the email field from the value in previousEmail field.

            For the ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the email before updating it, this object contains a previousEmail field with the user account's email address before updating. After the action completes, the user's email address will be updated to the value in the email field from the value in previousEmail field.

            For the ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to unenroll a newly added second factor, this object contains a multiFactorInfo field with the information about the second factor. For phone second factor, the multiFactorInfo is a MultiFactorInfo object, which contains the phone number.

          property operation

          operation: (typeof ActionCodeOperation)[keyof typeof ActionCodeOperation];
          • The type of operation that generated the action code.

          interface ActionCodeSettings

          interface ActionCodeSettings {}
          • An interface that defines the required continue/state URL with optional Android and iOS bundle identifiers.

            Modifiers

            • @public

          property android

          android?: {
          installApp?: boolean;
          minimumVersion?: string;
          packageName: string;
          };
          • Sets the Android package name.

            Remarks

            This will try to open the link in an android app if it is installed. If installApp is passed, it specifies whether to install the Android app if the device supports it and the app is not already installed. If this field is provided without a packageName, an error is thrown explaining that the packageName must be provided in conjunction with this field. If minimumVersion is specified, and an older version of the app is installed, the user is taken to the Play Store to upgrade the app.

          property dynamicLinkDomain

          dynamicLinkDomain?: string;
          • When multiple custom dynamic link domains are defined for a project, specify which one to use when the link is to be opened via a specified mobile app (for example, example.page.link).

          property handleCodeInApp

          handleCodeInApp?: boolean;
          • When set to true, the action code link will be be sent as a Universal Link or Android App Link and will be opened by the app if installed.

            Remarks

            In the false case, the code will be sent to the web widget first and then on continue will redirect to the app if installed.

          property iOS

          iOS?: {
          bundleId: string;
          };
          • Sets the iOS bundle ID.

            Remarks

            This will try to open the link in an iOS app if it is installed.

            App installation is not supported for iOS.

          property url

          url: string;
          • Sets the link continue/state URL.

            Remarks

            This has different meanings in different contexts: - When the link is handled in the web action widgets, this is the deep link in the continueUrl query parameter. - When the link is handled in the app directly, this is the continueUrl query parameter in the deep link of the Dynamic Link.

          interface AdditionalUserInfo

          interface AdditionalUserInfo {}
          • A structure containing additional user information from a federated identity provider.

            Modifiers

            • @public

          property isNewUser

          readonly isNewUser: boolean;
          • Whether the user is new (created via sign-up) or existing (authenticated using sign-in).

          property profile

          readonly profile: Record<string, unknown> | null;
          • Map containing IDP-specific user data.

          property providerId

          readonly providerId: string | null;
          • Identifier for the provider used to authenticate this user.

          property username

          readonly username?: string | null;
          • The username if the provider is GitHub or Twitter.

          interface ApplicationVerifier

          interface ApplicationVerifier {}
          • A verifier for domain verification and abuse prevention.

            Remarks

            Currently, the only implementation is RecaptchaVerifier.

            Modifiers

            • @public

          property type

          readonly type: string;
          • Identifies the type of application verifier (e.g. "recaptcha").

          method verify

          verify: () => Promise<string>;
          • Executes the verification process.

            Returns

            A Promise for a token that can be used to assert the validity of a request.

          interface Auth

          interface Auth {}
          • Interface representing Firebase Auth service.

            Remarks

            See Firebase Authentication for a full guide on how to use the Firebase Auth service.

            Modifiers

            • @public

          property app

          readonly app: FirebaseApp;

          property config

          readonly config: Config;
          • The Config used to initialize this instance.

          property currentUser

          readonly currentUser: User | null;
          • The currently signed-in user (or null).

          property emulatorConfig

          readonly emulatorConfig: EmulatorConfig | null;
          • The current emulator configuration (or null).

          property languageCode

          languageCode: string | null;
          • The Auth instance's language code.

            Remarks

            This is a readable/writable property. When set to null, the default Firebase Console language setting is applied. The language code will propagate to email action templates (password reset, email verification and email change revocation), SMS templates for phone authentication, reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support localization with the language code specified.

          property name

          readonly name: string;
          • The name of the app associated with the Auth service instance.

          property settings

          readonly settings: AuthSettings;
          • The Auth instance's settings.

            Remarks

            This is used to edit/read configuration related options such as app verification mode for phone authentication.

          property tenantId

          tenantId: string | null;
          • The Auth instance's tenant ID.

            Remarks

            This is a readable/writable property. When you set the tenant ID of an Auth instance, all future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to the specified tenant project. When set to null, users are signed in to the parent project.

            Example 1

            // Set the tenant ID on Auth instance.
            auth.tenantId = 'TENANT_PROJECT_ID';
            // All future sign-in request now include tenant ID.
            const result = await signInWithEmailAndPassword(auth, email, password);
            // result.user.tenantId should be 'TENANT_PROJECT_ID'.

          method authStateReady

          authStateReady: () => Promise<void>;
          • returns a promise that resolves immediately when the initial auth state is settled. When the promise resolves, the current user might be a valid user or null if the user signed out.

          method beforeAuthStateChanged

          beforeAuthStateChanged: (
          callback: (user: User | null) => void | Promise<void>,
          onAbort?: () => void
          ) => Unsubscribe;
          • Adds a blocking callback that runs before an auth state change sets a new user.

            Parameter callback

            callback triggered before new user value is set. If this throws, it blocks the user from being set.

            Parameter onAbort

            callback triggered if a later beforeAuthStateChanged() callback throws, allowing you to undo any side effects.

          method onAuthStateChanged

          onAuthStateChanged: (
          nextOrObserver: NextOrObserver<User | null>,
          error?: ErrorFn,
          completed?: CompleteFn
          ) => Unsubscribe;
          • Adds an observer for changes to the user's sign-in state.

            Parameter nextOrObserver

            callback triggered on change.

            Parameter error

            Deprecated. This callback is never triggered. Errors on signing in/out can be caught in promises returned from sign-in/sign-out functions.

            Parameter completed

            Deprecated. This callback is never triggered.

            Remarks

            To keep the old behavior, see Auth.onIdTokenChanged.

          method onIdTokenChanged

          onIdTokenChanged: (
          nextOrObserver: NextOrObserver<User | null>,
          error?: ErrorFn,
          completed?: CompleteFn
          ) => Unsubscribe;
          • Adds an observer for changes to the signed-in user's ID token.

            Parameter nextOrObserver

            callback triggered on change.

            Parameter error

            Deprecated. This callback is never triggered. Errors on signing in/out can be caught in promises returned from sign-in/sign-out functions.

            Parameter completed

            Deprecated. This callback is never triggered.

            Remarks

            This includes sign-in, sign-out, and token refresh events.

          method setPersistence

          setPersistence: (persistence: Persistence) => Promise<void>;
          • Changes the type of persistence on the Auth instance.

            Parameter persistence

            The Persistence to use.

            Remarks

            This will affect the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests.

            This makes it easy for a user signing in to specify whether their session should be remembered or not. It also makes it easier to never persist the Auth state for applications that are shared by other users or have sensitive data.

            This method does not work in a Node.js environment.

            Example 1

            auth.setPersistence(browserSessionPersistence);

          method signOut

          signOut: () => Promise<void>;
          • Signs out the current user. This does not automatically revoke the user's ID token.

            Remarks

            This method is not supported by Auth instances created with a @firebase/app#FirebaseServerApp.

          method updateCurrentUser

          updateCurrentUser: (user: User | null) => Promise<void>;
          • Asynchronously sets the provided user as Auth.currentUser on the Auth instance.

            Parameter user

            The new User.

            Remarks

            A new instance copy of the user provided will be made and set as currentUser.

            This will trigger Auth.onAuthStateChanged and Auth.onIdTokenChanged listeners like other sign in methods.

            The operation fails with an error if the user to be updated belongs to a different Firebase project.

          method useDeviceLanguage

          useDeviceLanguage: () => void;
          • Sets the current language to the default device/browser preference.

          interface AuthError

          interface AuthError extends FirebaseError {}
          • Interface for an Auth error.

            Modifiers

            • @public

          property customData

          readonly customData: {
          /** The name of the Firebase App which triggered this error. */
          readonly appName: string;
          /** The email address of the user's account, used for sign-in and linking. */
          readonly email?: string;
          /** The phone number of the user's account, used for sign-in and linking. */
          readonly phoneNumber?: string;
          /**
          * The tenant ID being used for sign-in and linking.
          *
          * @remarks
          * If you use {@link signInWithRedirect} to sign in,
          * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted
          * after redirection.
          */
          readonly tenantId?: string;
          };
          • Details about the Firebase Auth error.

          interface AuthErrorMap

          interface AuthErrorMap {}
          • A mapping of error codes to error messages.

            Remarks

            While error messages are useful for debugging (providing verbose textual context around what went wrong), these strings take up a lot of space in the compiled code. When deploying code in production, using prodErrorMap will save you roughly 10k compressed/gzipped over debugErrorMap. You can select the error map during initialization:

            initializeAuth(app, {errorMap: debugErrorMap})

            When initializing Auth, prodErrorMap is default.

            Modifiers

            • @public

          interface AuthProvider

          interface AuthProvider {}
          • Interface that represents an auth provider, used to facilitate creating AuthCredential.

            Modifiers

            • @public

          property providerId

          readonly providerId: string;
          • Provider for which credentials can be constructed.

          interface AuthSettings

          interface AuthSettings {}
          • Interface representing an Auth instance's settings.

            Remarks

            Currently used for enabling/disabling app verification for phone Auth testing.

            Modifiers

            • @public

          property appVerificationDisabledForTesting

          appVerificationDisabledForTesting: boolean;
          • When set, this property disables app verification for the purpose of testing phone authentication. For this property to take effect, it needs to be set before rendering a reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests.

            In order to use this feature, you will need to whitelist your phone number via the Firebase Console.

            The default value is false (app verification is enabled).

          interface Config

          interface Config {}
          • Interface representing the Auth config.

            Modifiers

            • @public

          property apiHost

          apiHost: string;
          • The host at which the Firebase Auth backend is running.

          property apiKey

          apiKey: string;
          • The API Key used to communicate with the Firebase Auth backend.

          property apiScheme

          apiScheme: string;
          • The scheme used to communicate with the Firebase Auth backend.

          property authDomain

          authDomain?: string;
          • The domain at which the web widgets are hosted (provided via Firebase Config).

          property sdkClientVersion

          sdkClientVersion: string;
          • The SDK Client Version.

          property tokenApiHost

          tokenApiHost: string;
          • The host at which the Secure Token API is running.

          interface ConfirmationResult

          interface ConfirmationResult {}
          • A result from a phone number sign-in, link, or reauthenticate call.

            Modifiers

            • @public

          property verificationId

          readonly verificationId: string;
          • The phone number authentication operation's verification ID.

            Remarks

            This can be used along with the verification code to initialize a PhoneAuthCredential.

          method confirm

          confirm: (verificationCode: string) => Promise<UserCredential>;
          • Finishes a phone number sign-in, link, or reauthentication.

            Parameter verificationCode

            The code that was sent to the user's mobile device.

            Example 1

            const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
            // Obtain verificationCode from the user.
            const userCredential = await confirmationResult.confirm(verificationCode);

          interface Dependencies

          interface Dependencies {}
          • The dependencies that can be used to initialize an Auth instance.

            Remarks

            The modular SDK enables tree shaking by allowing explicit declarations of dependencies. For example, a web app does not need to include code that enables Cordova redirect sign in. That functionality is therefore split into browserPopupRedirectResolver and cordovaPopupRedirectResolver. The dependencies object is how Auth is configured to reduce bundle sizes.

            There are two ways to initialize an Auth instance: getAuth and initializeAuth. getAuth initializes everything using platform-specific configurations, while initializeAuth takes a Dependencies object directly, giving you more control over what is used.

            Modifiers

            • @public

          property errorMap

          errorMap?: AuthErrorMap;

          property persistence

          persistence?: Persistence | Persistence[];
          • Which Persistence to use. If this is an array, the first Persistence that the device supports is used. The SDK searches for an existing account in order and, if one is found in a secondary Persistence, the account is moved to the primary Persistence.

            If no persistence is provided, the SDK falls back on inMemoryPersistence.

          property popupRedirectResolver

          popupRedirectResolver?: PopupRedirectResolver;

          interface EmulatorConfig

          interface EmulatorConfig {}
          • Configuration of Firebase Authentication Emulator.

            Modifiers

            • @public

          property host

          readonly host: string;
          • The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1") or quoted IPv6 address ("[::1]").

          property options

          readonly options: {
          /**
          * Whether the warning banner attached to the DOM was disabled.
          */
          readonly disableWarnings: boolean;
          };
          • The emulator-specific options.

          property port

          readonly port: number | null;
          • The port of the emulator, or null if port isn't specified (i.e. protocol default).

          property protocol

          readonly protocol: string;
          • The protocol used to communicate with the emulator ("http"/"https").

          interface IdTokenResult

          interface IdTokenResult {}
          • Interface representing ID token result obtained from User.getIdTokenResult.

            Remarks

            IdTokenResult contains the ID token JWT string and other helper properties for getting different data associated with the token as well as all the decoded payload claims.

            Note that these claims are not to be trusted as they are parsed client side. Only server side verification can guarantee the integrity of the token claims.

            Modifiers

            • @public

          property authTime

          authTime: string;
          • The authentication time formatted as a UTC string.

            Remarks

            This is the time the user authenticated (signed in) and not the time the token was refreshed.

          property claims

          claims: ParsedToken;
          • The entire payload claims of the ID token including the standard reserved claims as well as the custom claims.

          property expirationTime

          expirationTime: string;
          • The ID token expiration time formatted as a UTC string.

          property issuedAtTime

          issuedAtTime: string;
          • The ID token issuance time formatted as a UTC string.

          property signInProvider

          signInProvider: string | null;
          • The sign-in provider through which the ID token was obtained (anonymous, custom, phone, password, etc).

            Remarks

            Note, this does not map to provider IDs.

          property signInSecondFactor

          signInSecondFactor: string | null;
          • The type of second factor associated with this session, provided the user was multi-factor authenticated (eg. phone, etc).

          property token

          token: string;
          • The Firebase Auth ID token JWT string.

          interface MultiFactorAssertion

          interface MultiFactorAssertion {}
          • The base class for asserting ownership of a second factor.

            Remarks

            This is used to facilitate enrollment of a second factor on an existing user or sign-in of a user who already verified the first factor.

            Modifiers

            • @public

          property factorId

          readonly factorId: (typeof FactorId)[keyof typeof FactorId];
          • The identifier of the second factor.

          interface MultiFactorError

          interface MultiFactorError extends AuthError {}
          • The error thrown when the user needs to provide a second factor to sign in successfully.

            Remarks

            The error code for this error is auth/multi-factor-auth-required.

            Example 1

            let resolver;
            let multiFactorHints;
            signInWithEmailAndPassword(auth, email, password)
            .then((result) => {
            // User signed in. No 2nd factor challenge is needed.
            })
            .catch((error) => {
            if (error.code == 'auth/multi-factor-auth-required') {
            resolver = getMultiFactorResolver(auth, error);
            multiFactorHints = resolver.hints;
            } else {
            // Handle other errors.
            }
            });
            // Obtain a multiFactorAssertion by verifying the second factor.
            const userCredential = await resolver.resolveSignIn(multiFactorAssertion);

            Modifiers

            • @public

          property customData

          readonly customData: AuthError['customData'] & {
          /**
          * The type of operation (sign-in, linking, or re-authentication) that raised the error.
          */
          readonly operationType: (typeof OperationType)[keyof typeof OperationType];
          };
          • Details about the MultiFactorError.

          interface MultiFactorInfo

          interface MultiFactorInfo {}
          • A structure containing the information of a second factor entity.

            Modifiers

            • @public

          property displayName

          readonly displayName?: string | null;
          • The user friendly name of the current second factor.

          property enrollmentTime

          readonly enrollmentTime: string;
          • The enrollment date of the second factor formatted as a UTC string.

          property factorId

          readonly factorId: (typeof FactorId)[keyof typeof FactorId];
          • The identifier of the second factor.

          property uid

          readonly uid: string;
          • The multi-factor enrollment ID.

          interface MultiFactorResolver

          interface MultiFactorResolver {}
          • The class used to facilitate recovery from MultiFactorError when a user needs to provide a second factor to sign in.

            Example 1

            let resolver;
            let multiFactorHints;
            signInWithEmailAndPassword(auth, email, password)
            .then((result) => {
            // User signed in. No 2nd factor challenge is needed.
            })
            .catch((error) => {
            if (error.code == 'auth/multi-factor-auth-required') {
            resolver = getMultiFactorResolver(auth, error);
            // Show UI to let user select second factor.
            multiFactorHints = resolver.hints;
            } else {
            // Handle other errors.
            }
            });
            // The enrolled second factors that can be used to complete
            // sign-in are returned in the `MultiFactorResolver.hints` list.
            // UI needs to be presented to allow the user to select a second factor
            // from that list.
            const selectedHint = // ; selected from multiFactorHints
            const phoneAuthProvider = new PhoneAuthProvider(auth);
            const phoneInfoOptions = {
            multiFactorHint: selectedHint,
            session: resolver.session
            };
            const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
            // Store `verificationId` and show UI to let user enter verification code.
            // UI to enter verification code and continue.
            // Continue button click handler
            const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
            const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
            const userCredential = await resolver.resolveSignIn(multiFactorAssertion);

            Modifiers

            • @public

          property hints

          readonly hints: MultiFactorInfo[];
          • The list of hints for the second factors needed to complete the sign-in for the current session.

          property session

          readonly session: MultiFactorSession;
          • The session identifier for the current sign-in flow, which can be used to complete the second factor sign-in.

          method resolveSignIn

          resolveSignIn: (assertion: MultiFactorAssertion) => Promise<UserCredential>;
          • A helper function to help users complete sign in with a second factor using an MultiFactorAssertion confirming the user successfully completed the second factor challenge.

            Parameter assertion

            The multi-factor assertion to resolve sign-in with.

            Returns

            The promise that resolves with the user credential object.

            Example 1

            const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
            const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
            const userCredential = await resolver.resolveSignIn(multiFactorAssertion);

          interface MultiFactorSession

          interface 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.

            Modifiers

            • @public

          interface MultiFactorUser

          interface MultiFactorUser {}
          • An interface that defines the multi-factor related properties and operations pertaining to a User.

            Modifiers

            • @public

          property enrolledFactors

          readonly enrolledFactors: MultiFactorInfo[];
          • Returns a list of the user's enrolled second factors.

          method enroll

          enroll: (
          assertion: MultiFactorAssertion,
          displayName?: string | null
          ) => Promise<void>;
          • Enrolls a second factor as identified by the MultiFactorAssertion for the user.

            Parameter assertion

            The multi-factor assertion to enroll with.

            Parameter displayName

            The display name of the second factor.

            Remarks

            On resolution, the user tokens are updated to reflect the change in the JWT payload. Accepts an additional display name parameter used to identify the second factor to the end user. Recent re-authentication is required for this operation to succeed. On successful enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is enrolled, an email notification is sent to the user’s email.

            Example 1

            const multiFactorUser = multiFactor(auth.currentUser);
            const multiFactorSession = await multiFactorUser.getSession();
            // Send verification code.
            const phoneAuthProvider = new PhoneAuthProvider(auth);
            const phoneInfoOptions = {
            phoneNumber: phoneNumber,
            session: multiFactorSession
            };
            const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
            // Obtain verification code from user.
            const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
            const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
            await multiFactorUser.enroll(multiFactorAssertion);
            // Second factor enrolled.

          method getSession

          getSession: () => Promise<MultiFactorSession>;
          • Returns the session identifier for a second factor enrollment operation. This is used to identify the user trying to enroll a second factor.

            Returns

            The promise that resolves with the MultiFactorSession.

            Example 1

            const multiFactorUser = multiFactor(auth.currentUser);
            const multiFactorSession = await multiFactorUser.getSession();
            // Send verification code.
            const phoneAuthProvider = new PhoneAuthProvider(auth);
            const phoneInfoOptions = {
            phoneNumber: phoneNumber,
            session: multiFactorSession
            };
            const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
            // Obtain verification code from user.
            const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
            const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
            await multiFactorUser.enroll(multiFactorAssertion);

          method unenroll

          unenroll: (option: MultiFactorInfo | string) => Promise<void>;
          • Unenrolls the specified second factor.

            Parameter option

            The multi-factor option to unenroll.

            Returns

            - A Promise which resolves when the unenroll operation is complete.

            Remarks

            To specify the factor to remove, pass a MultiFactorInfo object (retrieved from MultiFactorUser.enrolledFactors) or the factor's UID string. Sessions are not revoked when the account is unenrolled. An email notification is likely to be sent to the user notifying them of the change. Recent re-authentication is required for this operation to succeed. When an existing factor is unenrolled, an email notification is sent to the user’s email.

            Example 1

            const multiFactorUser = multiFactor(auth.currentUser);
            // Present user the option to choose which factor to unenroll.
            await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i])

          interface OAuthCredentialOptions

          interface OAuthCredentialOptions {}
          • Defines the options for initializing an OAuthCredential.

            Remarks

            For ID tokens with nonce claim, the raw nonce has to also be provided.

            Modifiers

            • @public

          property accessToken

          accessToken?: string;

          property idToken

          idToken?: string;

          property rawNonce

          rawNonce?: string;
          • The raw nonce associated with the ID token.

            Remarks

            It is required when an ID token with a nonce field is provided. The SHA-256 hash of the raw nonce must match the nonce field in the ID token.

          interface ParsedToken

          interface ParsedToken {}
          • Interface representing a parsed ID token.

            Modifiers

            • @public

          property 'auth_time'

          auth_time?: string;
          • Time at which authentication was performed.

          property 'exp'

          exp?: string;
          • Expiration time of the token.

          property 'firebase'

          firebase?: {
          sign_in_provider?: string;
          sign_in_second_factor?: string;
          identities?: Record<string, string>;
          };
          • Firebase specific claims, containing the provider(s) used to authenticate the user.

          property 'iat'

          iat?: string;
          • Issuance time of the token.

          property 'sub'

          sub?: string;
          • UID of the user.

          index signature

          [key: string]: unknown;
          • Map of any additional custom claims.

          interface PasswordPolicy

          interface PasswordPolicy {}
          • A structure specifying password policy requirements.

            Modifiers

            • @public

          property allowedNonAlphanumericCharacters

          readonly allowedNonAlphanumericCharacters: string;
          • List of characters that are considered non-alphanumeric during validation.

          property customStrengthOptions

          readonly customStrengthOptions: {
          /**
          * Minimum password length, or undefined if not configured.
          */
          readonly minPasswordLength?: number;
          /**
          * Maximum password length, or undefined if not configured.
          */
          readonly maxPasswordLength?: number;
          /**
          * Whether the password should contain a lowercase letter, or undefined if not configured.
          */
          readonly containsLowercaseLetter?: boolean;
          /**
          * Whether the password should contain an uppercase letter, or undefined if not configured.
          */
          readonly containsUppercaseLetter?: boolean;
          /**
          * Whether the password should contain a numeric character, or undefined if not configured.
          */
          readonly containsNumericCharacter?: boolean;
          /**
          * Whether the password should contain a non-alphanumeric character, or undefined if not configured.
          */
          readonly containsNonAlphanumericCharacter?: boolean;
          };
          • Requirements enforced by this password policy.

          property enforcementState

          readonly enforcementState: string;
          • The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'.

          property forceUpgradeOnSignin

          readonly forceUpgradeOnSignin: boolean;
          • Whether existing passwords must meet the policy.

          interface PasswordValidationStatus

          interface PasswordValidationStatus {}
          • A structure indicating which password policy requirements were met or violated and what the requirements are.

            Modifiers

            • @public

          property containsLowercaseLetter

          readonly containsLowercaseLetter?: boolean;
          • Whether the password contains a lowercase letter, or undefined if not required.

          property containsNonAlphanumericCharacter

          readonly containsNonAlphanumericCharacter?: boolean;
          • Whether the password contains a non-alphanumeric character, or undefined if not required.

          property containsNumericCharacter

          readonly containsNumericCharacter?: boolean;
          • Whether the password contains a numeric character, or undefined if not required.

          property containsUppercaseLetter

          readonly containsUppercaseLetter?: boolean;
          • Whether the password contains an uppercase letter, or undefined if not required.

          property isValid

          readonly isValid: boolean;
          • Whether the password meets all requirements.

          property meetsMaxPasswordLength

          readonly meetsMaxPasswordLength?: boolean;
          • Whether the password meets the maximum password length, or undefined if not required.

          property meetsMinPasswordLength

          readonly meetsMinPasswordLength?: boolean;
          • Whether the password meets the minimum password length, or undefined if not required.

          property passwordPolicy

          readonly passwordPolicy: PasswordPolicy;
          • The policy used to validate the password.

          interface Persistence

          interface Persistence {}
          • An interface covering the possible persistence mechanism types.

            Modifiers

            • @public

          property type

          readonly type: 'SESSION' | 'LOCAL' | 'NONE';
          • Type of Persistence. - 'SESSION' is used for temporary persistence such as sessionStorage. - 'LOCAL' is used for long term persistence such as localStorage or IndexedDB. - 'NONE' is used for in-memory, or no persistence.

          interface PhoneMultiFactorAssertion

          interface PhoneMultiFactorAssertion extends MultiFactorAssertion {}

          interface PhoneMultiFactorEnrollInfoOptions

          interface PhoneMultiFactorEnrollInfoOptions {}
          • Options used for enrolling a second factor.

            Modifiers

            • @public

          property phoneNumber

          phoneNumber: string;
          • Phone number to send a verification code to.

          property session

          session: MultiFactorSession;

          interface PhoneMultiFactorInfo

          interface PhoneMultiFactorInfo extends MultiFactorInfo {}
          • The subclass of the MultiFactorInfo interface for phone number second factors. The factorId of this second factor is FactorId.PHONE.

            Modifiers

            • @public

          property phoneNumber

          readonly phoneNumber: string;
          • The phone number associated with the current second factor.

          interface PhoneMultiFactorSignInInfoOptions

          interface PhoneMultiFactorSignInInfoOptions {}
          • Options used for signing in with a second factor.

            Modifiers

            • @public

          property multiFactorHint

          multiFactorHint?: MultiFactorInfo;

          property multiFactorUid

          multiFactorUid?: string;
          • The uid of the second factor.

            One of multiFactorHint or multiFactorUid is required.

          property session

          session: MultiFactorSession;

          interface PhoneSingleFactorInfoOptions

          interface PhoneSingleFactorInfoOptions {}
          • Options used for single-factor sign-in.

            Modifiers

            • @public

          property phoneNumber

          phoneNumber: string;
          • Phone number to send a verification code to.

          interface PopupRedirectResolver

          interface PopupRedirectResolver {}

          interface ReactNativeAsyncStorage

          interface ReactNativeAsyncStorage {}
          • Interface for a supplied AsyncStorage.

            Modifiers

            • @public

          method getItem

          getItem: (key: string) => Promise<string | null>;
          • Retrieve an item from storage.

            Parameter key

            storage key.

          method removeItem

          removeItem: (key: string) => Promise<void>;
          • Remove an item from storage.

            Parameter key

            storage key.

          method setItem

          setItem: (key: string, value: string) => Promise<void>;
          • Persist an item in storage.

            Parameter key

            storage key.

            Parameter value

            storage value.

          interface RecaptchaParameters

          interface RecaptchaParameters {}
          • Interface representing reCAPTCHA parameters.

            See the [reCAPTCHA docs](https://developers.google.com/recaptcha/docs/display#render_param) for the list of accepted parameters. All parameters are accepted except for sitekey: Firebase Auth provisions a reCAPTCHA for each project and will configure the site key upon rendering.

            For an invisible reCAPTCHA, set the size key to invisible.

            Modifiers

            • @public

          index signature

          [key: string]: any;

            interface TotpMultiFactorAssertion

            interface TotpMultiFactorAssertion extends MultiFactorAssertion {}

            interface TotpMultiFactorInfo

            interface TotpMultiFactorInfo extends MultiFactorInfo {}
            • The subclass of the MultiFactorInfo interface for TOTP second factors. The factorId of this second factor is FactorId.TOTP.

              Modifiers

              • @public

            interface User

            interface User extends UserInfo {}
            • A user account.

              Modifiers

              • @public

            property emailVerified

            readonly emailVerified: boolean;

            property isAnonymous

            readonly isAnonymous: boolean;
            • Whether the user is authenticated using the ProviderId.ANONYMOUS provider.

            property metadata

            readonly metadata: UserMetadata;
            • Additional metadata around user creation and sign-in times.

            property providerData

            readonly providerData: UserInfo[];
            • Additional per provider such as displayName and profile information.

            property refreshToken

            readonly refreshToken: string;
            • Refresh token used to reauthenticate the user. Avoid using this directly and prefer User.getIdToken to refresh the ID token instead.

            property tenantId

            readonly tenantId: string | null;
            • The user's tenant ID.

              Remarks

              This is a read-only property, which indicates the tenant ID used to sign in the user. This is null if the user is signed in from the parent project.

              Example 1

              // Set the tenant ID on Auth instance.
              auth.tenantId = 'TENANT_PROJECT_ID';
              // All future sign-in request now include tenant ID.
              const result = await signInWithEmailAndPassword(auth, email, password);
              // result.user.tenantId should be 'TENANT_PROJECT_ID'.

            method delete

            delete: () => Promise<void>;
            • Deletes and signs out the user.

              Remarks

              Important: this is a security-sensitive operation that requires the user to have recently signed in. If this requirement isn't met, ask the user to authenticate again and then call one of the reauthentication methods like reauthenticateWithCredential.

              This method is not supported on any User signed in by Auth instances created with a @firebase/app#FirebaseServerApp.

            method getIdToken

            getIdToken: (forceRefresh?: boolean) => Promise<string>;
            • Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.

              Parameter forceRefresh

              Force refresh regardless of token expiration.

              Remarks

              Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.

            method getIdTokenResult

            getIdTokenResult: (forceRefresh?: boolean) => Promise<IdTokenResult>;
            • Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.

              Parameter forceRefresh

              Force refresh regardless of token expiration.

              Remarks

              Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.

            method reload

            reload: () => Promise<void>;
            • Refreshes the user, if signed in.

            method toJSON

            toJSON: () => object;
            • Returns a JSON-serializable representation of this object.

              Returns

              A JSON-serializable representation of this object.

            interface UserCredential

            interface UserCredential {}

            property operationType

            operationType: (typeof OperationType)[keyof typeof OperationType];
            • The type of operation which was used to authenticate the user (such as sign-in or link).

            property providerId

            providerId: string | null;
            • The provider which was used to authenticate the user.

            property user

            user: User;
            • The user authenticated by this credential.

            interface UserInfo

            interface UserInfo {}
            • User profile information, visible only to the Firebase project's apps.

              Modifiers

              • @public

            property displayName

            readonly displayName: string | null;
            • The display name of the user.

            property email

            readonly email: string | null;
            • The email of the user.

            property phoneNumber

            readonly phoneNumber: string | null;
            • The phone number normalized based on the E.164 standard (e.g. +16505550101) for the user.

              Remarks

              This is null if the user has no phone credential linked to the account.

            property photoURL

            readonly photoURL: string | null;
            • The profile photo URL of the user.

            property providerId

            readonly providerId: string;
            • The provider used to authenticate the user.

            property uid

            readonly uid: string;
            • The user's unique ID, scoped to the project.

            interface UserMetadata

            interface UserMetadata {}
            • Interface representing a user's metadata.

              Modifiers

              • @public

            property creationTime

            readonly creationTime?: string;
            • Time the user was created.

            property lastSignInTime

            readonly lastSignInTime?: string;
            • Time the user last signed in.

            Type Aliases

            type CustomParameters

            type CustomParameters = Record<string, string>;
            • Map of OAuth Custom Parameters.

              Modifiers

              • @public

            type NextOrObserver

            type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;
            • Type definition for an event callback.

              Modifiers

              • @public

            type PhoneInfoOptions

            type PhoneInfoOptions =
            | PhoneSingleFactorInfoOptions
            | PhoneMultiFactorEnrollInfoOptions
            | PhoneMultiFactorSignInInfoOptions;
            • The information required to verify the ownership of a phone number.

              Remarks

              The information that's required depends on whether you are doing single-factor sign-in, multi-factor enrollment or multi-factor sign-in.

              Modifiers

              • @public

            type UserProfile

            type UserProfile = Record<string, unknown>;

            Package Files (1)

            Dependencies (5)

            Dev Dependencies (11)

            Peer Dependencies (2)

            Badge

            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/auth.

            • Markdown
              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/auth)
            • HTML
              <a href="https://www.jsdocs.io/package/@firebase/auth"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>