Struct oauth2::TokenResponse

source ·
pub struct TokenResponse<EF: ExtraTokenFields, TT: TokenType> { /* private fields */ }
Expand description

Common methods shared by all OAuth2 token implementations.

The methods in this struct are defined in Section 5.1 of RFC 6749.

Implementations§

REQUIRED. The access token issued by the authorization server.

REQUIRED. The type of the token issued as described in Section 7.1. Value is case insensitive and deserialized to the generic TokenType parameter.

RECOMMENDED. The lifetime in seconds of the access token. For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated. If omitted, the authorization server SHOULD provide the expiration time via other means or document the default value.

OPTIONAL. The refresh token, which can be used to obtain new access tokens using the same authorization grant as described in Section 6.

OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. The scipe of the access token as described by Section 3.3. If included in the response, this space-delimited field is parsed into a Vec of individual scopes. If omitted from the response, this field is None.

Extra fields defined by client application.

Factory method to deserialize a Token from a JSON response.

Failures

If parsing fails, returns a serde_json::error::Error describing the parse error.

Trait Implementations§

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.