Trait FirebaseAuthBearer

Source
pub trait FirebaseAuthBearer {
    // Required methods
    fn project_id(&self) -> &str;
    fn access_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn access_token_unchecked<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn client(&self) -> &Client;
}
Expand description

Authentication trait.

This trait is implemented by crate::sessions.

Firestore document methods in crate::documents expect an object that implements this FirebaseAuthBearer trait.

Implement this trait for your own data structure and provide the Firestore project id and a valid access token.

Required Methods§

Source

fn project_id(&self) -> &str

Return the project ID. This is required for the firebase REST API.

Source

fn access_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An access token. If a refresh token is known and the access token expired, the implementation should try to refresh the access token before returning.

Source

fn access_token_unchecked<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The access token, unchecked. Might be expired or in other ways invalid.

Source

fn client(&self) -> &Client

The reqwest http client. The Client holds a connection pool internally, so it is advised that it is reused for multiple, successive connections.

Implementors§

Source§

impl FirebaseAuthBearer for firestore_db_and_auth::sessions::service_account::Session

Source§

impl FirebaseAuthBearer for firestore_db_and_auth::sessions::user::Session