pub trait FirebaseAuthService<ApiHttpClientT>where
    Self: Send + Sync,
    ApiHttpClientT: ApiHttpClient + Send + Sync,{
    // Required methods
    fn get_client(&self) -> &ApiHttpClientT;
    fn get_auth_uri_builder(&self) -> &ApiUriBuilder;

    // Provided methods
    fn create_user<'life0, 'async_trait>(
        &'life0 self,
        user: NewUser
    ) -> Pin<Box<dyn Future<Output = Result<User, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn get_user<'life0, 'async_trait>(
        &'life0 self,
        indentifiers: UserIdentifiers
    ) -> Pin<Box<dyn Future<Output = Result<Option<User>, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn get_users<'life0, 'async_trait>(
        &'life0 self,
        indentifiers: UserIdentifiers
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<User>>, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn list_users<'life0, 'async_trait>(
        &'life0 self,
        users_per_page: usize,
        prev: Option<UserList>
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserList>, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn delete_user<'life0, 'async_trait>(
        &'life0 self,
        uid: String
    ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn delete_users<'life0, 'async_trait>(
        &'life0 self,
        uids: Vec<String>,
        force: bool
    ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn update_user<'life0, 'async_trait>(
        &'life0 self,
        update: UserUpdate
    ) -> Pin<Box<dyn Future<Output = Result<User, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn import_users<'life0, 'async_trait>(
        &'life0 self,
        users: Vec<UserImportRecord>
    ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn generate_email_action_link<'life0, 'async_trait>(
        &'life0 self,
        oob_action: OobCodeAction
    ) -> Pin<Box<dyn Future<Output = Result<String, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn create_session_cookie<'life0, 'async_trait>(
        &'life0 self,
        id_token: String,
        expires_in: Duration
    ) -> Pin<Box<dyn Future<Output = Result<String, Report<ApiClientError>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Provided Methods§

source

fn create_user<'life0, 'async_trait>( &'life0 self, user: NewUser ) -> Pin<Box<dyn Future<Output = Result<User, Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Creates a new user account with the specified properties.

Example
let new_user = auth.create_user(
    NewUser::email_and_password(
       "test@example.com".into(),
       "123ABC".into(),
    )
).await.unwrap();
source

fn get_user<'life0, 'async_trait>( &'life0 self, indentifiers: UserIdentifiers ) -> Pin<Box<dyn Future<Output = Result<Option<User>, Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get first user that matches given identifier filter

Example
let user = auth.get_user(
    UserIdentifiers {
        email: Some(vec!["me@example.com".into()]),
        ..Default::default()
    }
).await.unwrap();
source

fn get_users<'life0, 'async_trait>( &'life0 self, indentifiers: UserIdentifiers ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<User>>, Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get all users that match a given identifier filter

Example
let users = auth.get_users(
    UserIdentifiers {
        email: Some(vec!["me@example.com".into()]),
        uid: Some(vec!["A123456".into()]),
        ..Default::default()
    }
).await.unwrap().unwrap();
source

fn list_users<'life0, 'async_trait>( &'life0 self, users_per_page: usize, prev: Option<UserList> ) -> Pin<Box<dyn Future<Output = Result<Option<UserList>, Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Fetch all users in batches of users_per_page, to progress pass previous page into the method’s prev.

Example
let mut user_page: Option<UserList> = None;
loop {
    user_page = auth.list_users(10, user_page).await.unwrap();

    if let Some(user_page) = &user_page {
        for user in &user_page.users {
            println!("User: {user:?}");
        }
    } else {
        break;
    }
}
source

fn delete_user<'life0, 'async_trait>( &'life0 self, uid: String ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Delete user with given ID

source

fn delete_users<'life0, 'async_trait>( &'life0 self, uids: Vec<String>, force: bool ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Delete all users with given list of IDs

source

fn update_user<'life0, 'async_trait>( &'life0 self, update: UserUpdate ) -> Pin<Box<dyn Future<Output = Result<User, Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Update user with given changes

Example
let update = UserUpdate::builder("ID123".into())
    .display_name(AttributeOp::Change("My new name".into()))
    .phone_number(AttributeOp::Delete)
    .email("new@example.com".into())
    .build();
auth.update_user(update).await.unwrap();
source

fn import_users<'life0, 'async_trait>( &'life0 self, users: Vec<UserImportRecord> ) -> Pin<Box<dyn Future<Output = Result<(), Report<ApiClientError>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Create users in bulk

Example
let records = vec![
    UserImportRecord::builder()
        .with_email("me@example.com".into(), true)
        .with_display_name("My Name".into())
        .build()
];
auth.import_users(records).await.unwrap();

Send email with OOB code action

Example
let oob_action = OobCodeAction::builder(
    OobCodeActionType::PasswordReset,
    "me@example.com".into()
).build();

let link = auth.generate_email_action_link(oob_action).await.unwrap();

Create session cookie that then can be verified and parsed with App::live().cookie_token_verifier()

Implementors§

source§

impl<ApiHttpClientT> FirebaseAuthService<ApiHttpClientT> for FirebaseAuth<ApiHttpClientT>where ApiHttpClientT: ApiHttpClient + Send + Sync,