firebase_admin.auth module Stay organized with collections Save and categorize content based on your preferences.
Firebase Authentication module.
This module contains functions for minting and verifying JWTs used forauthenticating against Firebase services. It also provides functions forcreating and managing user accounts in Firebase projects.
Exceptions
CertificateFetchErrorexceptionfirebase_admin.auth.CertificateFetchError(message,cause) |
|---|
Bases: Failed to fetch some public key certificates required to verify a token. |
ConfigurationNotFoundErrorexceptionfirebase_admin.auth.ConfigurationNotFoundError(message,cause=None,http_response=None) |
|---|
Bases: No auth provider found for the specified identifier.
|
EmailAlreadyExistsErrorexceptionfirebase_admin.auth.EmailAlreadyExistsError(message,cause,http_response) |
|---|
Bases: The user with the provided email already exists.
|
EmailNotFoundErrorexceptionfirebase_admin.auth.EmailNotFoundError(message,cause=None,http_response=None) |
|---|
Bases: No user record found for the specified email.
|
ExpiredIdTokenErrorexceptionfirebase_admin.auth.ExpiredIdTokenError(message,cause) |
|---|
Bases: The provided ID token is expired. |
ExpiredSessionCookieErrorexceptionfirebase_admin.auth.ExpiredSessionCookieError(message,cause) |
|---|
Bases: The provided session cookie is expired. |
InsufficientPermissionErrorexceptionfirebase_admin.auth.InsufficientPermissionError(message,cause,http_response) |
|---|
Bases: The credential used to initialize the SDK lacks required permissions.
|
InvalidDynamicLinkDomainErrorexceptionfirebase_admin.auth.InvalidDynamicLinkDomainError(message,cause,http_response) |
|---|
Bases: Dynamic link domain in ActionCodeSettings is not authorized.
|
InvalidHostingLinkDomainErrorexceptionfirebase_admin.auth.InvalidHostingLinkDomainError(message,cause,http_response) |
|---|
Bases: The provided hosting link domain is not configured in Firebase Hostingor is not owned by the current project.
|
InvalidIdTokenErrorexceptionfirebase_admin.auth.InvalidIdTokenError(message,cause=None,http_response=None) |
|---|
Bases: The provided ID token is not a valid Firebase ID token.
|
InvalidSessionCookieErrorexceptionfirebase_admin.auth.InvalidSessionCookieError(message,cause=None) |
|---|
Bases: The provided string is not a valid Firebase session cookie. |
PhoneNumberAlreadyExistsErrorexceptionfirebase_admin.auth.PhoneNumberAlreadyExistsError(message,cause,http_response) |
|---|
Bases: The user with the provided phone number already exists.
|
ResetPasswordExceedLimitErrorexceptionfirebase_admin.auth.ResetPasswordExceedLimitError(message,cause=None,http_response=None) |
|---|
Bases: Reset password emails exceeded their limits. |
RevokedIdTokenErrorexceptionfirebase_admin.auth.RevokedIdTokenError(message) |
|---|
Bases: The provided ID token has been revoked. |
RevokedSessionCookieErrorexceptionfirebase_admin.auth.RevokedSessionCookieError(message) |
|---|
Bases: The provided session cookie has been revoked. |
TokenSignErrorexceptionfirebase_admin.auth.TokenSignError(message,cause) |
|---|
Bases: Unexpected error while signing a Firebase custom token. |
TooManyAttemptsTryLaterErrorexceptionfirebase_admin.auth.TooManyAttemptsTryLaterError(message,cause=None,http_response=None) |
|---|
Bases: Rate limited because of too many attempts. |
UidAlreadyExistsErrorexceptionfirebase_admin.auth.UidAlreadyExistsError(message,cause,http_response) |
|---|
Bases: The user with the provided uid already exists.
|
UnexpectedResponseErrorexceptionfirebase_admin.auth.UnexpectedResponseError(message,cause=None,http_response=None) |
|---|
Bases: Backend service responded with an unexpected or malformed response. |
UserDisabledErrorexceptionfirebase_admin.auth.UserDisabledError(message,cause=None,http_response=None) |
|---|
Bases: An operation failed due to a user record being disabled.
|
UserNotFoundErrorexceptionfirebase_admin.auth.UserNotFoundError(message,cause=None,http_response=None) |
|---|
Bases: No user record found for the specified identifier.
|
Classes
ActionCodeSettingsclassfirebase_admin.auth.ActionCodeSettings(url:str,handle_code_in_app:bool|None=None,dynamic_link_domain:str|None=None,ios_bundle_id:str|None=None,android_package_name:str|None=None,android_install_app:str|None=None,android_minimum_version:str|None=None,link_domain:str|None=None) |
|---|
Bases: Contains required continue/state URL with optional Android and iOS settings.Used when invoking the email action link generation APIs. |
Clientclassfirebase_admin.auth.Client(app,tenant_id=None) | ||
|---|---|---|
Bases: Firebase Authentication client scoped to a specific tenant.
|
DeleteUsersResultclassfirebase_admin.auth.DeleteUsersResult(result,total) | ||||||
|---|---|---|---|---|---|---|
Bases: Represents the result of the
|
EmailIdentifierclassfirebase_admin.auth.EmailIdentifier(email) | ||
|---|---|---|
Bases: Used for looking up an account by email. See
|
ErrorInfoclassfirebase_admin.auth.ErrorInfo(error) | ||||
|---|---|---|---|---|
Bases: Represents an error encountered while performing a batch operation suchas importing users or deleting multiple user accounts.
|
ExportedUserRecordclassfirebase_admin.auth.ExportedUserRecord(data) | ||||
|---|---|---|---|---|
Bases: Contains metadata associated with a user including password hash and salt.
|
GetUsersResultclassfirebase_admin.auth.GetUsersResult(users,not_found) | ||||
|---|---|---|---|---|
Bases: Represents the result of the
|
ImportUserRecordclassfirebase_admin.auth.ImportUserRecord(uid,email=None,email_verified=None,display_name=None,phone_number=None,photo_url=None,disabled=None,user_metadata=None,provider_data=None,custom_claims=None,password_hash=None,password_salt=None) | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents a user account to be imported to Firebase Auth. Must specify the
|
ListProviderConfigsPageclassfirebase_admin.auth.ListProviderConfigsPage(download,page_token,max_results) | ||||||
|---|---|---|---|---|---|---|
Bases: Represents a page of AuthProviderConfig instances retrieved from a Firebase project. Provides methods for traversing the provider configs included in this page, as well asretrieving subsequent pages. The iterator returned by
|
ListUsersPageclassfirebase_admin.auth.ListUsersPage(download,page_token,max_results) | ||||||
|---|---|---|---|---|---|---|
Bases: Represents a page of user records exported from a Firebase project. Provides methods for traversing the user accounts included in this page, as well as retrievingsubsequent pages of users. The iterator returned by
|
OIDCProviderConfigclassfirebase_admin.auth.OIDCProviderConfig(data) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents the OIDC auth provider configuration. Seehttps://openid.net/specs/openid-connect-core-1_0-final.html.
|
PhoneIdentifierclassfirebase_admin.auth.PhoneIdentifier(phone_number) | ||
|---|---|---|
Bases: Used for looking up an account by phone number. See
|
ProviderConfigclassfirebase_admin.auth.ProviderConfig(data) | ||||||
|---|---|---|---|---|---|---|
Bases: Parent type for all authentication provider config types.
|
ProviderIdentifierclassfirebase_admin.auth.ProviderIdentifier(provider_id,provider_uid) | ||||
|---|---|---|---|---|
Bases: Used for looking up an account by provider. See
|
SAMLProviderConfigclassfirebase_admin.auth.SAMLProviderConfig(data) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents he SAML auth provider configuration. Seehttp://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html.
|
UidIdentifierclassfirebase_admin.auth.UidIdentifier(uid) | ||
|---|---|---|
Bases: Used for looking up an account by uid. See
|
UserIdentifierclassfirebase_admin.auth.UserIdentifier |
|---|
Bases: Identifies a user to be looked up. |
UserImportHashclassfirebase_admin.auth.UserImportHash(name,data=None) |
|---|
Bases: Represents a hash algorithm used to hash user passwords. An instance of this class must be specified when importing users with passwords via the
|
UserImportResultclassfirebase_admin.auth.UserImportResult(result,total) | ||||||
|---|---|---|---|---|---|---|
Bases: Represents the result of a bulk user import operation. See
|
UserInfoclassfirebase_admin.auth.UserInfo | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bases: A collection of standard profile information for a user. Used to expose profile information returned by an identity provider.
|
UserMetadataclassfirebase_admin.auth.UserMetadata(creation_timestamp=None,last_sign_in_timestamp=None,last_refresh_timestamp=None) | ||||||
|---|---|---|---|---|---|---|
Bases: Contains additional metadata associated with a user account.
|
UserProviderclassfirebase_admin.auth.UserProvider(uid,provider_id,email=None,display_name=None,photo_url=None) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents a user identity provider that can be associated with a Firebase user. One or more providers can be specified in an
|
UserRecordclassfirebase_admin.auth.UserRecord(data) | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bases: Contains metadata associated with a Firebase user account.
|
Functions
create_custom_tokenfirebase_admin.auth.create_custom_token(uid,developer_claims=None,app=None) |
|---|
Builds and signs a Firebase custom auth token.
|
create_oidc_provider_configfirebase_admin.auth.create_oidc_provider_config(provider_id,client_id,issuer,display_name=None,enabled=None,client_secret=None,id_token_response_type=None,code_response_type=None,app=None) |
|---|
Creates a new OIDC provider config from the given parameters. OIDC provider support requires Google Cloud’s Identity Platform (GCIP). To learn more aboutGCIP, including pricing and features, seehttps://cloud.google.com/identity-platform.
|
create_saml_provider_configfirebase_admin.auth.create_saml_provider_config(provider_id,idp_entity_id,sso_url,x509_certificates,rp_entity_id,callback_url,display_name=None,enabled=None,app=None) |
|---|
Creates a new SAML provider config from the given parameters. SAML provider support requires Google Cloud’s Identity Platform (GCIP). To learn more aboutGCIP, including pricing and features, seehttps://cloud.google.com/identity-platform.
|
create_session_cookiefirebase_admin.auth.create_session_cookie(id_token,expires_in,app=None) |
|---|
Creates a new Firebase session cookie from the given ID token and options. The returned JWT can be set as a server-side session cookie with a custom cookie policy.
|
create_userfirebase_admin.auth.create_user(**kwargs) |
|---|
Creates a new user account with the specified properties.
|
delete_oidc_provider_configfirebase_admin.auth.delete_oidc_provider_config(provider_id,app=None) |
|---|
Deletes the
|
delete_saml_provider_configfirebase_admin.auth.delete_saml_provider_config(provider_id,app=None) |
|---|
Deletes the
|
delete_userfirebase_admin.auth.delete_user(uid,app=None) |
|---|
Deletes the user identified by the specified user ID.
|
delete_usersfirebase_admin.auth.delete_users(uids,app=None) |
|---|
Deletes the users specified by the given identifiers. Deleting a non-existing user does not generate an error (the method isidempotent.) Non-existing users are considered to be successfully deletedand are therefore included in theDeleteUserResult.success_count value. A maximum of 1000 identifiers may be supplied. If more than 1000identifiers are supplied, this method raises aValueError.
|
generate_email_verification_linkfirebase_admin.auth.generate_email_verification_link(email,action_code_settings=None,app=None) |
|---|
Generates the out-of-band email action link for email verification flows for the specifiedemail address.
|
generate_password_reset_linkfirebase_admin.auth.generate_password_reset_link(email,action_code_settings=None,app=None) |
|---|
Generates the out-of-band email action link for password reset flows for the specified emailaddress.
|
generate_sign_in_with_email_linkfirebase_admin.auth.generate_sign_in_with_email_link(email,action_code_settings,app=None) |
|---|
Generates the out-of-band email action link for email link sign-in flows, using the actioncode settings provided.
|
get_oidc_provider_configfirebase_admin.auth.get_oidc_provider_config(provider_id,app=None) |
|---|
Returns the
|
get_saml_provider_configfirebase_admin.auth.get_saml_provider_config(provider_id,app=None) |
|---|
Returns the
|
get_userfirebase_admin.auth.get_user(uid,app=None) |
|---|
Gets the user data corresponding to the specified user ID.
|
get_user_by_emailfirebase_admin.auth.get_user_by_email(email,app=None) |
|---|
Gets the user data corresponding to the specified user email.
|
get_user_by_phone_numberfirebase_admin.auth.get_user_by_phone_number(phone_number,app=None) |
|---|
Gets the user data corresponding to the specified phone number.
|
get_usersfirebase_admin.auth.get_users(identifiers,app=None) |
|---|
Gets the user data corresponding to the specified identifiers. There are no ordering guarantees; in particular, the nth entry in theresult list is not guaranteed to correspond to the nth entry in the inputparameters list. A maximum of 100 identifiers may be supplied. If more than 100identifiers are supplied, this method raises aValueError.
|
import_usersfirebase_admin.auth.import_users(users,hash_alg=None,app=None) |
|---|
Imports the specified list of users into Firebase Auth. At most 1000 users can be imported at a time. This operation is optimized for bulk imports andwill ignore checks on identifier uniqueness which could result in duplications. The
|
list_saml_provider_configsfirebase_admin.auth.list_saml_provider_configs(page_token=None,max_results=100,app=None) |
|---|
Retrieves a page of SAML provider configs from a Firebase project. The
|
list_usersfirebase_admin.auth.list_users(page_token=None,max_results=1000,app=None) |
|---|
Retrieves a page of user accounts from a Firebase project. The
|
revoke_refresh_tokensfirebase_admin.auth.revoke_refresh_tokens(uid,app=None) |
|---|
Revokes all refresh tokens for an existing user. This function updates the user’s While this revokes all sessions for a specified user and disables any new ID tokens forexisting sessions from getting minted, existing ID tokens may remain active until theirnatural expiration (one hour). To verify that ID tokens are revoked, use
|
set_custom_user_claimsfirebase_admin.auth.set_custom_user_claims(uid,custom_claims,app=None) |
|---|
Sets additional claims on an existing user account. Custom claims set via this function can be used to define user roles and privilege levels.These claims propagate to all the devices where the user is already signed in (after tokenexpiration or when token refresh is forced), and next time the user signs in. The claimscan be accessed via the user’s ID token JWT. If a reserved OIDC claim is specified (sub, iat,iss, etc), an error is thrown. Claims payload must also not be larger then 1000 characterswhen serialized into a JSON string.
|
update_oidc_provider_configfirebase_admin.auth.update_oidc_provider_config(provider_id,client_id=None,issuer=None,display_name=None,enabled=None,client_secret=None,id_token_response_type=None,code_response_type=None,app=None) |
|---|
Updates an existing OIDC provider config with the given parameters.
|
update_saml_provider_configfirebase_admin.auth.update_saml_provider_config(provider_id,idp_entity_id=None,sso_url=None,x509_certificates=None,rp_entity_id=None,callback_url=None,display_name=None,enabled=None,app=None) |
|---|
Updates an existing SAML provider config with the given parameters.
|
update_userfirebase_admin.auth.update_user(uid,**kwargs) |
|---|
Updates an existing user account with the specified properties.
|
verify_id_tokenfirebase_admin.auth.verify_id_token(id_token,app=None,check_revoked=False,clock_skew_seconds=0) |
|---|
Verifies the signature and data for the provided JWT. Accepts a signed token string, verifies that it is current, and issuedto this project, and that it was correctly signed by Google.
|
verify_session_cookiefirebase_admin.auth.verify_session_cookie(session_cookie,check_revoked=False,app=None,clock_skew_seconds=0) |
|---|
Verifies a Firebase session cookie. Accepts a session cookie string, verifies that it is current, and issuedto this project, and that it was correctly signed by Google.
|
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-07-31 UTC.