firebase-admin.auth package

Firebase Authentication.

Functions

FunctionDescription
getAuth(app)Gets theAuth service for the default app or a given app.getAuth() can be called with no arguments to access the default app'sAuth service or asgetAuth(app) to access theAuth service associated with a specific app.

Classes

ClassDescription
AuthAuth service bound to the provided app. An Auth instance can have multiple tenants.
AuthClientErrorCodeAuth client error codes and their default messages.
BaseAuthCommon parent interface for bothAuth andTenantAwareAuth APIs.
FirebaseAuthErrorFirebase Auth error code structure. This extends PrefixedFirebaseError.
MultiFactorInfoInterface representing the common properties of a user-enrolled second factor.
MultiFactorSettingsThe multi-factor related user settings.
PhoneMultiFactorInfoInterface representing a phone specific user-enrolled second factor.
ProjectConfigRepresents a project configuration.
ProjectConfigManagerManages (gets and updates) the current project config.
TenantRepresents a tenant configuration.Multi-tenancy support requires Google Cloud's Identity Platform (GCIP). To learn more about GCIP, including pricing and features, see theGCIP documentation.Before multi-tenancy can be used on a Google Cloud Identity Platform project, tenants must be allowed on that project via the Cloud Console UI.A tenant configuration provides information such as the display name, tenant identifier and email authentication configuration. For OIDC/SAML provider configuration management,TenantAwareAuth instances should be used instead of aTenant to retrieve the list of configured IdPs on a tenant. When configuring these providers, note that tenants will inherit whitelisted domains and authenticated redirect URIs of their parent project.All other settings of a tenant will also be inherited. These will need to be managed from the Cloud Console UI.
TenantAwareAuthTenant-awareAuth interface used for managing users, configuring SAML/OIDC providers, generating email links for password reset, email verification, etc for specific tenants.Multi-tenancy support requires Google Cloud's Identity Platform (GCIP). To learn more about GCIP, including pricing and features, see theGCIP documentation.Each tenant contains its own identity providers, settings and sets of users. UsingTenantAwareAuth, users for a specific tenant and corresponding OIDC/SAML configurations can also be managed, ID tokens for users signed in to a specific tenant can be verified, and email action links can also be generated for users belonging to the tenant.TenantAwareAuth instances for a specifictenantId can be instantiated by callingTenantManager.authForTenant().
TenantManagerDefines the tenant manager used to help manage tenant related operations. This includes:
  • The ability to create, update, list, get and delete tenants for the underlying project.
  • Getting aTenantAwareAuth instance for running Auth related operations (user management, provider configuration management, token verification, email link generation, etc) in the context of a specified tenant.
UserInfoRepresents a user's info from a third-party identity provider such as Google or Facebook.
UserMetadataRepresents a user's metadata.
UserRecordRepresents a user.

Interfaces

InterfaceDescription
ActionCodeSettingsThis is the interface that defines the required continue/state URL with optional Android and iOS bundle identifiers.
AllowByDefaultDefines a policy of allowing every region by default and adding disallowed regions to a disallow list.
AllowByDefaultWrapMutual exclusive SMS Region Config of AllowByDefault interface
AllowlistOnlyDefines a policy of only allowing regions by explicitly adding them to an allowlist.
AllowlistOnlyWrapMutually exclusive SMS Region Config of AllowlistOnly interface
AuthProviderConfigFilterThe filter interface used for listing provider configurations. This is used when specifying how to list configured identity providers viaBaseAuth.listProviderConfigs().
BaseAuthProviderConfigThe base Auth provider configuration interface.
BaseCreateMultiFactorInfoRequestInterface representing base properties of a user-enrolled second factor for aCreateRequest.
BaseUpdateMultiFactorInfoRequestInterface representing common properties of a user-enrolled second factor for anUpdateRequest.
CreatePhoneMultiFactorInfoRequestInterface representing a phone specific user-enrolled second factor for aCreateRequest.
CreateRequestInterface representing the properties to set on a new user record to be created.
CustomStrengthOptionsConfigConstraints to be enforced on the password policy
DecodedAuthBlockingToken
DecodedIdTokenInterface representing a decoded Firebase ID token, returned from theBaseAuth.verifyIdToken() method.Firebase ID tokens are OpenID Connect spec-compliant JSON Web Tokens (JWTs). See the [ID Token section of the OpenID Connect spec](http://openid.net/specs/openid-connect-core-1_0.html#IDToken) for more information about the specific properties below.
DeleteUsersResultRepresents the result of theBaseAuth.deleteUsers(). API.
EmailIdentifierUsed for looking up an account by email.SeeBaseAuth.getUsers().
EmailPrivacyConfigThe email privacy configuration of a project or tenant.
EmailSignInProviderConfigThe email sign in provider configuration.
GetUsersResultRepresents the result of theBaseAuth.getUsers() API.
ListProviderConfigResultsThe response interface for listing provider configs. This is only available when listing all identity providers' configurations viaBaseAuth.listProviderConfigs().
ListTenantsResultInterface representing the object returned from aTenantManager.listTenants() operation. Contains the list of tenants for the current batch and the next page token if available.
ListUsersResultInterface representing the object returned from aBaseAuth.listUsers() operation. Contains the list of users for the current batch and the next page token if available.
MobileLinksConfigConfiguration for settings related to univeral links (iOS) and app links (Android).
MultiFactorConfigInterface representing a multi-factor configuration. This can be used to define whether multi-factor authentication is enabled or disabled and the list of second factor challenges that are supported.
MultiFactorCreateSettingsThe multi-factor related user settings for create operations.
MultiFactorProviderConfigInterface representing a multi-factor auth provider configuration. This interface is used for second factor auth providers other than SMS. Currently, only TOTP is supported.
MultiFactorUpdateSettingsThe multi-factor related user settings for update operations.
OAuthResponseTypeThe interface representing OIDC provider's response object for OAuth authorization flow. One of the following settings is required:
  • Setcode totrue for the code flow.
  • SetidToken totrue for the ID token flow.
OIDCAuthProviderConfigThe [OIDC](https://openid.net/specs/openid-connect-core-1_0-final.html) Auth provider configuration interface. An OIDC provider can be created viaBaseAuth.createProviderConfig().
OIDCUpdateAuthProviderRequestThe request interface for updating an OIDC Auth provider. This is used when updating an OIDC provider's configuration viaBaseAuth.updateProviderConfig().
PasswordPolicyConfigA password policy configuration for a project or tenant
PhoneIdentifierUsed for looking up an account by phone number.SeeBaseAuth.getUsers().
ProviderIdentifierUsed for looking up an account by federated provider.SeeBaseAuth.getUsers().
RecaptchaConfigThe request interface for updating a reCAPTCHA Config. By enabling reCAPTCHA Enterprise Integration you are agreeing to reCAPTCHA EnterpriseTerm of Service.
RecaptchaKeyThe reCAPTCHA key config.
RecaptchaManagedRuleThe config for a reCAPTCHA action rule.
RecaptchaTollFraudManagedRuleThe managed rules for toll fraud provider, containing the enforcement status. The toll fraud provider contains all SMS related user flows.
SAMLAuthProviderConfigThe [SAML](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html) Auth provider configuration interface. A SAML provider can be created viaBaseAuth.createProviderConfig().
SAMLUpdateAuthProviderRequestThe request interface for updating a SAML Auth provider. This is used when updating a SAML provider's configuration viaBaseAuth.updateProviderConfig().
SessionCookieOptionsInterface representing the session cookie options needed for theBaseAuth.createSessionCookie() method.
TotpMultiFactorProviderConfigInterface representing configuration settings for TOTP second factor auth.
UidIdentifierUsed for looking up an account by uid.SeeBaseAuth.getUsers().
UpdatePhoneMultiFactorInfoRequestInterface representing a phone specific user-enrolled second factor for anUpdateRequest.
UpdateProjectConfigRequestInterface representing the properties to update on the provided project config.
UpdateRequestInterface representing the properties to update on the provided user.
UpdateTenantRequestInterface representing the properties to update on the provided tenant.
UserImportOptionsInterface representing the user import options needed forBaseAuth.importUsers() method. This is used to provide the password hashing algorithm information.
UserImportRecordInterface representing a user to import to Firebase Auth via theBaseAuth.importUsers() method.
UserImportResultInterface representing the response from theBaseAuth.importUsers() method for batch importing users to Firebase Auth.
UserMetadataRequestUser metadata to include when importing a user.
UserProviderRepresents a user identity provider that can be associated with a Firebase user.
UserProviderRequestUser provider data to include when importing a user.

Type Aliases

Type AliasDescription
AuthFactorTypeIdentifies a second factor type.
AuthProviderConfigThe Auth provider configuration type.BaseAuth.createProviderConfig().
CreateMultiFactorInfoRequestType representing the properties of a user-enrolled second factor for aCreateRequest.
CreateTenantRequestInterface representing the properties to set on a new tenant.
HashAlgorithmType
MobileLinksDomainOpen code in app domain to use for app links and universal links.
MultiFactorConfigStateIdentifies a multi-factor configuration state.
PasswordPolicyEnforcementStateA password policy's enforcement state.
RecaptchaActionThe actions to take for reCAPTCHA-protected requests. - 'BLOCK': The reCAPTCHA-protected request will be blocked.
RecaptchaKeyClientTypeThe key's platform type.
RecaptchaProviderEnforcementStateEnforcement state of reCAPTCHA protection. - 'OFF': Unenforced. - 'AUDIT': Create assessment but don't enforce the result. - 'ENFORCE': Create assessment and enforce the result.
SmsRegionConfigThe request interface for updating a SMS Region Config. Configures the regions where users are allowed to send verification SMS. This is based on the calling code of the destination phone number.
UpdateAuthProviderRequest
UpdateMultiFactorInfoRequestType representing the properties of a user-enrolled second factor for anUpdateRequest.
UserIdentifierIdentifies a user to be looked up.

getAuth(app)

Gets theAuth service for the default app or a given app.

getAuth() can be called with no arguments to access the default app'sAuth service or asgetAuth(app) to access theAuth service associated with a specific app.

Signature:

exportdeclarefunctiongetAuth(app?:App):Auth;

Parameters

ParameterTypeDescription
appApp

Returns:

Auth

Example 1

// Get the Auth service for the default appconstdefaultAuth=getAuth();

Example 2

// Get the Auth service for a given appconstotherAuth=getAuth(otherApp);

AuthFactorType

Identifies a second factor type.

Signature:

exporttypeAuthFactorType='phone';

AuthProviderConfig

The Auth provider configuration type.BaseAuth.createProviderConfig().

Signature:

exporttypeAuthProviderConfig=SAMLAuthProviderConfig|OIDCAuthProviderConfig;

CreateMultiFactorInfoRequest

Type representing the properties of a user-enrolled second factor for aCreateRequest.

Signature:

exporttypeCreateMultiFactorInfoRequest=CreatePhoneMultiFactorInfoRequest;

CreateTenantRequest

Interface representing the properties to set on a new tenant.

Signature:

exporttypeCreateTenantRequest=UpdateTenantRequest;

HashAlgorithmType

Signature:

exporttypeHashAlgorithmType='SCRYPT'|'STANDARD_SCRYPT'|'HMAC_SHA512'|'HMAC_SHA256'|'HMAC_SHA1'|'HMAC_MD5'|'MD5'|'PBKDF_SHA1'|'BCRYPT'|'PBKDF2_SHA256'|'SHA512'|'SHA256'|'SHA1';

MobileLinksDomain

Open code in app domain to use for app links and universal links.

Signature:

exporttypeMobileLinksDomain='HOSTING_DOMAIN'|'FIREBASE_DYNAMIC_LINK_DOMAIN';

MultiFactorConfigState

Identifies a multi-factor configuration state.

Signature:

exporttypeMultiFactorConfigState='ENABLED'|'DISABLED';

PasswordPolicyEnforcementState

A password policy's enforcement state.

Signature:

exporttypePasswordPolicyEnforcementState='ENFORCE'|'OFF';

RecaptchaAction

The actions to take for reCAPTCHA-protected requests. - 'BLOCK': The reCAPTCHA-protected request will be blocked.

Signature:

exporttypeRecaptchaAction='BLOCK';

RecaptchaKeyClientType

The key's platform type.

Signature:

exporttypeRecaptchaKeyClientType='WEB'|'IOS'|'ANDROID';

RecaptchaProviderEnforcementState

Enforcement state of reCAPTCHA protection. - 'OFF': Unenforced. - 'AUDIT': Create assessment but don't enforce the result. - 'ENFORCE': Create assessment and enforce the result.

Signature:

exporttypeRecaptchaProviderEnforcementState='OFF'|'AUDIT'|'ENFORCE';

SmsRegionConfig

The request interface for updating a SMS Region Config. Configures the regions where users are allowed to send verification SMS. This is based on the calling code of the destination phone number.

Signature:

exporttypeSmsRegionConfig=AllowByDefaultWrap|AllowlistOnlyWrap;

UpdateAuthProviderRequest

Signature:

exporttypeUpdateAuthProviderRequest=SAMLUpdateAuthProviderRequest|OIDCUpdateAuthProviderRequest;

UpdateMultiFactorInfoRequest

Type representing the properties of a user-enrolled second factor for anUpdateRequest.

Signature:

exporttypeUpdateMultiFactorInfoRequest=UpdatePhoneMultiFactorInfoRequest;

UserIdentifier

Identifies a user to be looked up.

Signature:

exporttypeUserIdentifier=UidIdentifier|EmailIdentifier|PhoneIdentifier|ProviderIdentifier;

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-02-06 UTC.