[−][src]Struct yup_oauth2::Token
Represents a token as returned by OAuth2 servers.
It is produced by all authentication flows. It authenticates certain operations, and must be refreshed once it reached it's expiry date.
The type is tuned to be suitable for direct de-serialization from server replies, as well as for serialization for later reuse. This is the reason for the two fields dealing with expiry - once in relative in and once in absolute terms.
Utility methods make common queries easier, see expired()
.
Fields
access_token: String
used when authenticating calls to oauth2 enabled services.
refresh_token: String
used to refresh an expired access_token.
token_type: String
The token type as string - usually 'Bearer'.
expires_in: Option<i64>
access_token will expire after this amount of time. Prefer using expiry_date()
expires_in_timestamp: Option<i64>
timestamp is seconds since epoch indicating when the token will expire in absolute terms. use expiry_date() to convert to DateTime.
Methods
impl Token
[src]
pub fn expired(&self) -> bool
[src]
pub fn expiry_date(&self) -> DateTime<Utc>
[src]
Returns a DateTime object representing our expiry date.
pub fn set_expiry_absolute(&mut self) -> &mut Token
[src]
Adjust our stored expiry format to be absolute, using the current time.
Trait Implementations
impl Clone for Token
[src]
fn clone(&self) -> Token
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Token> for Token
[src]
impl Debug for Token
[src]
impl Serialize for Token
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Token
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Typeable for T where
T: Any,
T: Any,