pub struct TokenResponse {
pub access_token: String,
pub token_type: String,
pub expires_in: i64,
pub scope: Option<String>,
pub refresh_token: Option<String>,
pub id_token: Option<String>,
pub issued_token_type: Option<String>,
pub extra: HashMap<String, Value>,
}Expand description
A successful OAuth 2.0 token endpoint response (RFC 6749 §5.1).
Standard parameters are modelled as typed fields; any additional
provider-specific parameters are preserved in TokenResponse::extra so
unknown fields are ignored, not rejected. expires_in is tolerated as a
JSON number, a numeric string, or null, since some providers deviate from
the RFC’s number type (CC-001).
Debug is hand-written to redact the access_token, refresh_token, and
id_token values so bearer tokens do not leak into logs (#24); the presence
of the optional tokens is still shown.
Fields§
§access_token: StringThe issued access token (required).
token_type: StringThe token type, typically Bearer (required).
expires_in: i64The access token lifetime in seconds, if provided. Absent, null, or an
empty value is reported as 0.
scope: Option<String>The granted scope, if it differs from the request.
refresh_token: Option<String>The issued refresh token, if any.
id_token: Option<String>The OIDC ID token, present for the authorization code grant when the
openid scope was requested.
issued_token_type: Option<String>The URI naming the type of the issued token, returned by the RFC 8693
token exchange grant (RFC 8693 §2.2, EXCH-005). REQUIRED in an exchange
response and absent from every other grant’s, so it is modelled as an
Option rather than defaulted to an empty string. It MAY differ from
the requested_token_type that was asked for.
extra: HashMap<String, Value>Any non-standard parameters returned by the provider.