[−][src]Struct firestore_db_and_auth::sessions::user::Session
An impersonated session. Firestore rules will restrict your access.
Fields
user_id: String
The firebase auth user id
refresh_token: Option<String>
The refresh token, if any. Such a token allows you to generate new, valid access tokens. This library will handle this for you, if for example your current access token expired.
api_key: String
The firebase projects API key, as defined in the credentials object
client: Client
The http client. Replace or modify the client if you have special demands like proxy support
client_async: Client
The http client for async operations. Replace or modify the client if you have special demands like proxy support
Implementations
impl Session
[src]
pub fn new(
credentials: &Credentials,
user_id: Option<&str>,
firebase_tokenid: Option<&str>,
refresh_token: Option<&str>
) -> Result<Session, FirebaseError>
[src]
credentials: &Credentials,
user_id: Option<&str>,
firebase_tokenid: Option<&str>,
refresh_token: Option<&str>
) -> Result<Session, FirebaseError>
Create an impersonated session
If the optionally provided access token is still valid, it will be used. If the access token is not valid anymore, but the given refresh token is, it will be used to retrieve a new access token.
If neither refresh token nor access token work are provided or valid, the service account credentials will be used to generate a new impersonated refresh and access token for the given user.
If none of the parameters are given, the function will error out.
Async support: This is a blocking operation.
See:
- https://firebase.google.com/docs/reference/rest/auth#section-refresh-token
- https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library
pub fn by_refresh_token(
credentials: &Credentials,
refresh_token: &str
) -> Result<Session, FirebaseError>
[src]
credentials: &Credentials,
refresh_token: &str
) -> Result<Session, FirebaseError>
Create a new firestore user session via a valid refresh_token
Arguments:
credentials
The credentialsrefresh_token
A refresh token.
Async support: This is a blocking operation.
pub fn by_user_id(
credentials: &Credentials,
user_id: &str,
with_refresh_token: bool
) -> Result<Session, FirebaseError>
[src]
credentials: &Credentials,
user_id: &str,
with_refresh_token: bool
) -> Result<Session, FirebaseError>
Create a new firestore user session with a fresh access token.
Arguments:
credentials
The credentialsuser_id
The firebase Authentication user id. Usually a string of about 30 characters like "Io2cPph06rUWM3ABcIHguR3CIw6v1".with_refresh_token
A refresh token is returned as well. This should be persisted somewhere for later reuse. Google generates only a few dozens of refresh tokens before it starts to invalidate already generated ones. For short lived, immutable, non-persisting services you do not want a refresh token.
pub fn by_access_token(
credentials: &Credentials,
firebase_tokenid: &str
) -> Result<Session, FirebaseError>
[src]
credentials: &Credentials,
firebase_tokenid: &str
) -> Result<Session, FirebaseError>
Trait Implementations
impl FirebaseAuthBearer for Session
[src]
pub fn project_id(&self) -> &str
[src]
pub 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
pub fn access_token_unchecked(&self) -> String
[src]
pub fn client(&self) -> &Client
[src]
pub fn client_async(&self) -> &Client
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Session
[src]
impl Send for Session
[src]
impl !Sync for Session
[src]
impl Unpin for Session
[src]
impl !UnwindSafe for Session
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
pub fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,