pub struct FirebaseAuth { /* private fields */ }Expand description
Client for interacting with Firebase Authentication.
Implementations§
Source§impl FirebaseAuth
impl FirebaseAuth
Sourcepub fn new(middleware: AuthMiddleware) -> Self
pub fn new(middleware: AuthMiddleware) -> Self
Creates a new FirebaseAuth instance.
This is typically called via FirebaseApp::auth().
Sourcepub fn tenant_manager(&self) -> TenantAwareness
pub fn tenant_manager(&self) -> TenantAwareness
Returns the tenant awareness interface.
Sourcepub fn project_config_manager(&self) -> ProjectConfig
pub fn project_config_manager(&self) -> ProjectConfig
Returns the project config interface.
Sourcepub async fn verify_id_token(
&self,
token: &str,
) -> Result<FirebaseTokenClaims, AuthError>
pub async fn verify_id_token( &self, token: &str, ) -> Result<FirebaseTokenClaims, AuthError>
Verifies a Firebase ID token.
This method fetches Google’s public keys (caching them respecting Cache-Control) and verifies the signature, audience, issuer, and expiration of the token.
§Arguments
token- The JWT ID token string.
Creates a session cookie from an ID token.
§Arguments
id_token- The ID token to exchange for a session cookie.valid_duration- The duration for which the session cookie is valid.
Sourcepub fn create_custom_token(
&self,
uid: &str,
custom_claims: Option<Map<String, Value>>,
) -> Result<String, AuthError>
pub fn create_custom_token( &self, uid: &str, custom_claims: Option<Map<String, Value>>, ) -> Result<String, AuthError>
Creates a custom token for the given UID with optional custom claims.
This token can be sent to a client application to sign in with signInWithCustomToken.
§Arguments
uid- The unique identifier for the user.custom_claims- Optional JSON object containing custom claims.
Sourcepub async fn generate_password_reset_link(
&self,
email: &str,
settings: Option<ActionCodeSettings>,
) -> Result<String, AuthError>
pub async fn generate_password_reset_link( &self, email: &str, settings: Option<ActionCodeSettings>, ) -> Result<String, AuthError>
Generates a link for password reset.
Sourcepub async fn generate_email_verification_link(
&self,
email: &str,
settings: Option<ActionCodeSettings>,
) -> Result<String, AuthError>
pub async fn generate_email_verification_link( &self, email: &str, settings: Option<ActionCodeSettings>, ) -> Result<String, AuthError>
Generates a link for email verification.
Sourcepub async fn generate_sign_in_with_email_link(
&self,
email: &str,
settings: Option<ActionCodeSettings>,
) -> Result<String, AuthError>
pub async fn generate_sign_in_with_email_link( &self, email: &str, settings: Option<ActionCodeSettings>, ) -> Result<String, AuthError>
Generates a link for sign-in with email.
Sourcepub async fn import_users(
&self,
request: ImportUsersRequest,
) -> Result<ImportUsersResponse, AuthError>
pub async fn import_users( &self, request: ImportUsersRequest, ) -> Result<ImportUsersResponse, AuthError>
Imports users in bulk.
§Arguments
request- AnImportUsersRequestcontaining the list of users and hashing algorithm configuration.
Sourcepub async fn create_user(
&self,
request: CreateUserRequest,
) -> Result<UserRecord, AuthError>
pub async fn create_user( &self, request: CreateUserRequest, ) -> Result<UserRecord, AuthError>
Creates a new user.
Sourcepub async fn update_user(
&self,
request: UpdateUserRequest,
) -> Result<UserRecord, AuthError>
pub async fn update_user( &self, request: UpdateUserRequest, ) -> Result<UserRecord, AuthError>
Updates an existing user.
Sourcepub async fn get_user(&self, uid: &str) -> Result<UserRecord, AuthError>
pub async fn get_user(&self, uid: &str) -> Result<UserRecord, AuthError>
Retrieves a user by their UID.
Sourcepub async fn get_user_by_email(
&self,
email: &str,
) -> Result<UserRecord, AuthError>
pub async fn get_user_by_email( &self, email: &str, ) -> Result<UserRecord, AuthError>
Retrieves a user by their email.
Sourcepub async fn get_user_by_phone_number(
&self,
phone: &str,
) -> Result<UserRecord, AuthError>
pub async fn get_user_by_phone_number( &self, phone: &str, ) -> Result<UserRecord, AuthError>
Retrieves a user by their phone number.
Sourcepub async fn list_users(
&self,
max_results: u32,
page_token: Option<&str>,
) -> Result<ListUsersResponse, AuthError>
pub async fn list_users( &self, max_results: u32, page_token: Option<&str>, ) -> Result<ListUsersResponse, AuthError>
Lists users.
§Arguments
max_results- The maximum number of users to return.page_token- The next page token from a previous response.
Trait Implementations§
Source§impl Clone for FirebaseAuth
impl Clone for FirebaseAuth
Source§fn clone(&self) -> FirebaseAuth
fn clone(&self) -> FirebaseAuth
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more