[][src]Trait firestore_db_and_auth::FirebaseAuthBearer

pub trait FirebaseAuthBearer {
    fn project_id(&self) -> &str;
fn access_token(&self) -> String;
fn access_token_unchecked(&self) -> String;
fn client(&self) -> &Client; }

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

fn project_id(&self) -> &str

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

fn access_token(&self) -> String

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.

fn access_token_unchecked(&self) -> String

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

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.

Loading content...

Implementors

impl FirebaseAuthBearer for firestore_db_and_auth::sessions::service_account::Session[src]

fn access_token(&self) -> String[src]

Return the encoded jwt to be used as bearer token. If the jwt issue_at is older than 50 minutes, it will be updated to the current time.

impl FirebaseAuthBearer for firestore_db_and_auth::sessions::user::Session[src]

fn access_token(&self) -> String[src]

Returns the current access token. This method will automatically refresh your access token, if it has expired.

If the refresh failed, this will

Loading content...