Firebase Authentication module.
This module contains functions for minting and verifying JWTs used for authenticating against Firebase services. It also provides functions for creating and managing user accounts in Firebase projects.
Exceptions
CertificateFetchErrorexception firebase_admin.auth.CertificateFetchError(message, cause) |
---|
Bases: Failed to fetch some public key certificates required to verify a token. |
ConfigurationNotFoundErrorexception firebase_admin.auth.ConfigurationNotFoundError(message, cause=None, http_response=None) |
---|
Bases: No auth provider found for the specified identifier.
|
EmailAlreadyExistsErrorexception firebase_admin.auth.EmailAlreadyExistsError(message, cause, http_response) |
---|
Bases: The user with the provided email already exists.
|
EmailNotFoundErrorexception firebase_admin.auth.EmailNotFoundError(message, cause=None, http_response=None) |
---|
Bases: No user record found for the specified email.
|
ExpiredIdTokenErrorexception firebase_admin.auth.ExpiredIdTokenError(message, cause) |
---|
Bases: The provided ID token is expired. |
ExpiredSessionCookieErrorexception firebase_admin.auth.ExpiredSessionCookieError(message, cause) |
---|
Bases: The provided session cookie is expired. |
InsufficientPermissionErrorexception firebase_admin.auth.InsufficientPermissionError(message, cause, http_response) |
---|
Bases: The credential used to initialize the SDK lacks required permissions.
|
InvalidDynamicLinkDomainErrorexception firebase_admin.auth.InvalidDynamicLinkDomainError(message, cause, http_response) |
---|
Bases: Dynamic link domain in ActionCodeSettings is not authorized.
|
InvalidHostingLinkDomainErrorexception firebase_admin.auth.InvalidHostingLinkDomainError(message, cause, http_response) |
---|
Bases: The provided hosting link domain is not configured in Firebase Hosting or is not owned by the current project.
|
InvalidIdTokenErrorexception firebase_admin.auth.InvalidIdTokenError(message, cause=None, http_response=None) |
---|
Bases: The provided ID token is not a valid Firebase ID token.
|
InvalidSessionCookieErrorexception firebase_admin.auth.InvalidSessionCookieError(message, cause=None) |
---|
Bases: The provided string is not a valid Firebase session cookie. |
PhoneNumberAlreadyExistsErrorexception firebase_admin.auth.PhoneNumberAlreadyExistsError(message, cause, http_response) |
---|
Bases: The user with the provided phone number already exists.
|
ResetPasswordExceedLimitErrorexception firebase_admin.auth.ResetPasswordExceedLimitError(message, cause=None, http_response=None) |
---|
Bases: Reset password emails exceeded their limits. |
RevokedIdTokenErrorexception firebase_admin.auth.RevokedIdTokenError(message) |
---|
Bases: The provided ID token has been revoked. |
RevokedSessionCookieErrorexception firebase_admin.auth.RevokedSessionCookieError(message) |
---|
Bases: The provided session cookie has been revoked. |
TokenSignErrorexception firebase_admin.auth.TokenSignError(message, cause) |
---|
Bases: Unexpected error while signing a Firebase custom token. |
TooManyAttemptsTryLaterErrorexception firebase_admin.auth.TooManyAttemptsTryLaterError(message, cause=None, http_response=None) |
---|
Bases: Rate limited because of too many attempts. |
UidAlreadyExistsErrorexception firebase_admin.auth.UidAlreadyExistsError(message, cause, http_response) |
---|
Bases: The user with the provided uid already exists.
|
UnexpectedResponseErrorexception firebase_admin.auth.UnexpectedResponseError(message, cause=None, http_response=None) |
---|
Bases: Backend service responded with an unexpected or malformed response. |
UserDisabledErrorexception firebase_admin.auth.UserDisabledError(message, cause=None, http_response=None) |
---|
Bases: An operation failed due to a user record being disabled.
|
UserNotFoundErrorexception firebase_admin.auth.UserNotFoundError(message, cause=None, http_response=None) |
---|
Bases: No user record found for the specified identifier.
|
Classes
ActionCodeSettingsclass firebase_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. |
Clientclass firebase_admin.auth.Client(app, tenant_id=None) | ||
---|---|---|
Bases: Firebase Authentication client scoped to a specific tenant.
|
DeleteUsersResultclass firebase_admin.auth.DeleteUsersResult(result, total) | ||||||
---|---|---|---|---|---|---|
Bases: Represents the result of the
|
EmailIdentifierclass firebase_admin.auth.EmailIdentifier(email) | ||
---|---|---|
Bases: Used for looking up an account by email. See
|
ErrorInfoclass firebase_admin.auth.ErrorInfo(error) | ||||
---|---|---|---|---|
Bases: Represents an error encountered while performing a batch operation such as importing users or deleting multiple user accounts.
|
ExportedUserRecordclass firebase_admin.auth.ExportedUserRecord(data) | ||||
---|---|---|---|---|
Bases: Contains metadata associated with a user including password hash and salt.
|
GetUsersResultclass firebase_admin.auth.GetUsersResult(users, not_found) | ||||
---|---|---|---|---|
Bases: Represents the result of the
|
ImportUserRecordclass firebase_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
|
ListProviderConfigsPageclass firebase_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 as
retrieving subsequent pages. The iterator returned by
|
ListUsersPageclass firebase_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 retrieving
subsequent pages of users. The iterator returned by
|
OIDCProviderConfigclass firebase_admin.auth.OIDCProviderConfig(data) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents the OIDC auth provider configuration. See https://openid.net/specs/openid-connect-core-1_0-final.html.
|
PhoneIdentifierclass firebase_admin.auth.PhoneIdentifier(phone_number) | ||
---|---|---|
Bases: Used for looking up an account by phone number. See
|
ProviderConfigclass firebase_admin.auth.ProviderConfig(data) | ||||||
---|---|---|---|---|---|---|
Bases: Parent type for all authentication provider config types.
|
ProviderIdentifierclass firebase_admin.auth.ProviderIdentifier(provider_id, provider_uid) | ||||
---|---|---|---|---|
Bases: Used for looking up an account by provider. See
|
SAMLProviderConfigclass firebase_admin.auth.SAMLProviderConfig(data) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Bases: Represents he SAML auth provider configuration. See http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html.
|
UidIdentifierclass firebase_admin.auth.UidIdentifier(uid) | ||
---|---|---|
Bases: Used for looking up an account by uid. See
|
UserIdentifierclass firebase_admin.auth.UserIdentifier |
---|
Bases: Identifies a user to be looked up. |
UserImportHashclass firebase_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
|
UserImportResultclass firebase_admin.auth.UserImportResult(result, total) | ||||||
---|---|---|---|---|---|---|
Bases: Represents the result of a bulk user import operation. See
|
UserInfoclass firebase_admin.auth.UserInfo | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Bases: A collection of standard profile information for a user. Used to expose profile information returned by an identity provider.
|
UserMetadataclass firebase_admin.auth.UserMetadata(creation_timestamp=None, last_sign_in_timestamp=None, last_refresh_timestamp=None) | ||||||
---|---|---|---|---|---|---|
Bases: Contains additional metadata associated with a user account.
|
UserProviderclass firebase_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
|
UserRecordclass firebase_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 about GCIP, including pricing and features, see https://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 about GCIP, including pricing and features, see https://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 is idempotent.) Non-existing users are considered to be successfully deleted and are therefore included in the DeleteUserResult.success_count value. A maximum of 1000 identifiers may be supplied. If more than 1000 identifiers are supplied, this method raises a ValueError.
|
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 specified email 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 email address.
|
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 action code 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 the result list is not guaranteed to correspond to the nth entry in the input parameters list. A maximum of 100 identifiers may be supplied. If more than 100 identifiers are supplied, this method raises a ValueError.
|
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 and
will 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 for
existing sessions from getting minted, existing ID tokens may remain active until their
natural 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 token expiration or when token refresh is forced), and next time the user signs in. The claims can 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 characters when 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 issued to 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 issued to this project, and that it was correctly signed by Google.
|