Skip to main content

parse_exchange_response

Function parse_exchange_response 

Source
pub fn parse_exchange_response(body: &str) -> Result<ExchangedToken>
Expand description

Parse the JSON body of a successful POST /oauth/token exchange.

Validates access_token is present and, when the endpoint sets them, that token_type is a supported value (Bearer or, since #1425, DPoP for a sender-bound token) and issued_token_type is the access-token type — defending against a misrouted/shape-changed response being treated as a valid credential. The parsed TokenType tells the caller whether downstream resource requests must carry a DPoP proof.