#[non_exhaustive]pub struct Token {
pub access_token: SensitiveString,
pub refresh_token: Option<SensitiveString>,
pub token_type: String,
pub expires_in: Option<u64>,
pub scope: Option<String>,
pub expires_at: Option<DateTime<Utc>>,
}Expand description
A token response. expires_in is a lifetime that starts decaying the moment the server
answers, so expires_at is worked out from it on arrival and is the field to keep: a
moment stays true however long it is held. The server never sends it, so it defaults to
None when it is missing and is written back out with the rest.
The SDK stores nothing itself. Whoever keeps a token between runs stores this or their
own shape, and either way carries expires_at with it, or the next run has no idea
when the token is spent.
The two tokens are SensitiveStrings: serde-transparent, so the wire is what the
server sent, but [REDACTED] under {:?}.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.access_token: SensitiveStringWhat goes in Authorization on every request.
refresh_token: Option<SensitiveString>What buys the next access token once this one is spent, when the server issued one.
token_type: StringHow the access token is presented: Bearer, for HEY.
expires_in: Option<u64>How many seconds the access token was good for when the server answered.
scope: Option<String>What the token was granted, when the server said.
expires_at: Option<DateTime<Utc>>The moment the access token is spent, worked out from expires_in on arrival.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Token
impl<'de> Deserialize<'de> for Token
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnsafeUnpin for Token
impl UnwindSafe for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.