[][src]Struct rocket_oauth2::TokenResponse

pub struct TokenResponse { /* fields omitted */ }

The server's response to a successful token exchange, defined in in RFC 6749 §5.1.

Methods

impl TokenResponse[src]

pub fn as_value(&self) -> &Value[src]

Get the TokenResponse data as a raw JSON Value. It is guaranteed to be of type Object.

pub fn access_token(&self) -> &str[src]

Get the access token issued by the authorization server.

pub fn token_type(&self) -> &str[src]

Get the type of token, described in RFC 6749 §7.1.

pub fn expires_in(&self) -> Option<i64>[src]

Get the lifetime in seconds of the access token, if the authorization server provided one.

pub fn refresh_token(&self) -> Option<&str>[src]

Get the refresh token, if the server provided one.

pub fn scope(&self) -> Option<&str>[src]

Get the (space-separated) list of scopes associated with the access token. The authorization server is required to provide this if it differs from the requested set of scopes.

If scope was not provided by the server as a string, this method will return None. For those providers, use `.as_value().get("scope") instead.

Trait Implementations

impl Clone for TokenResponse[src]

impl PartialEq<TokenResponse> for TokenResponse[src]

impl Debug for TokenResponse[src]

impl TryFrom<Value> for TokenResponse[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(data: Value) -> Result<Self, Error>[src]

Construct a TokenResponse from a Value.

Returns an Error if data is not a JSON Object, or the access_token or token_type is missing or not a string.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,