firebasil.auth module
- class firebasil.auth.AuthClient(api_key: str, identity_toolkit_url: str = <factory>, secure_token_url: str = <factory>, use_emulator_routes: bool = <factory>)
A connection to Firebase auth. Should be used as an async context manager.
Setting the
FIREBASE_AUTH_EMULATOR_HOSTenvironment variable will change the defaults of this class to use the emulator endpoint and routes.- api_key: str
API key
- async change_email(id_token: str, new_email: str, locale: Optional[str] = None)
Change a user’s email.
Optionally, a locale string can be passed to localize the revocation email sent to the user.
- async change_password(id_token: str, new_password: str)
Change a user’s password.
- async confirm_email_verification(code: str)
Confirm the email verification code sent to the user.
- async confirm_password_reset(reset_code: str, new_password: str)
Set a new password after the reset code is confirmed.
- async delete_account(id_token: str) None
Delete an account.
- async emulator_clear_accounts(project_id: str)
Remove all user accounts.
Only available for the auth emulator.
- async emulator_get_configuration(project_id: str)
Get emulator configuration.
Only available for the auth emulator.
- async emulator_get_out_of_band_codes(project_id: str)
Get out-of-band codes sent to an auth emulator.
Only available for the auth emulator.
- async emulator_get_sms_codes(project_id: str)
Get SMS verification codes sent to an auth emulator.
Only available for the auth emulator.
- async emulator_update_configuration(project_id: str, allow_duplicate_emails: bool)
Update the emulator configuration.
Only available for the auth emulator.
- async get_associated_providers(email: str, continue_uri: str)
Get OAuth providers associated with a given email.
- async get_user_data(id_token: str)
Get information about a user.
- identity_toolkit_url: str
URL of the identity toolkit to use. Defaults to the production value unless the
FIREBASE_AUTH_EMULATOR_HOSTenvironment variable is set, when it will use that value.
- async link_account_with_email_and_password(id_token: str, email: str, password: str)
Associate an email and password with a given user.
- async link_account_with_oauth_credential(id_token: str, request_uri: str, provider_token: str, provider_id: str, return_idp_credential: bool)
Associate an account with an OAuth credential.
- async refresh(refresh_token: str)
Trade a refresh token for a new ID token.
- secure_token_url: str
URL of the secure token endpoint to use Defaults to the production value unless the
FIREBASE_AUTH_EMULATOR_HOSTenvironment variable is set, when it will use that value.
- async send_email_verification(id_token: str, locale: Optional[str] = None)
Send an email confirmation email to a user.
Optionally, a locale string can be passed to localize the confirmation email sent to the user.
- async send_password_reset_email(email: str, locale: Optional[str] = None)
Send a password reset email to the given email.
Optionally, a locale string can be passed to localize the password reset email.
- async sign_in_anonymous()
Sign in anonymously.
- async sign_in_with_custom_token(token: str)
Sign a user in with a custom token.
- async sign_in_with_oauth(request_uri: str, provider_token: str, provider_id: str, return_idp_credential: bool)
Sign in with an OAuth credential.
- async sign_in_with_password(email: str, password: str)
Sign in with email and password.
- async sign_up(email: str, password: str)
Sign up a new user.
- async unlink_provider(id_token: str, provider_ids: List[str])
Unlink an account from the given provider IDs.
- async update_profile(id_token: str, display_name: Optional[str] = None, photo_url: Optional[str] = None, delete_display_name: bool = False, delete_photo: bool = False)
Update or remove a user’s display name and/or photo.
- use_emulator_routes: bool
Whether to use emulator routes Defaults to False unless the
FIREBASE_AUTH_EMULATOR_HOSTenvironment variable is set.
- async verify_password_reset_code(reset_code: str)
Verify the code sent via a password reset email.