pub struct HttpTokenEndpoint { /* private fields */ }Expand description
Redeems authorization codes at one token endpoint.
Clone because a caller will hold this across the user-visible round trip
— or hand it to something that outlives the call that built it — and the
reqwest client underneath pools connections worth sharing.
Implementations§
Source§impl HttpTokenEndpoint
impl HttpTokenEndpoint
Sourcepub fn new(endpoint: impl AsRef<str>) -> Self
pub fn new(endpoint: impl AsRef<str>) -> Self
An endpoint to post token requests to.
The HTTP client is built once, so a per-request TLS handshake and a fresh pool do not happen on the authorization path. No timeout is set here: an endpoint that stops answering must eventually be reported as unavailable, and the transport’s own timeout is where a deployment decides how patient to be.
Sourcepub fn with_http_client(self, http: Client) -> Self
pub fn with_http_client(self, http: Client) -> Self
Replaces the HTTP client, for a caller that needs a timeout, a proxy or custom TLS settings.
There is deliberately no with_timeout shortcut: reqwest’s builder
returns a Result, and a shortcut would either swallow that error or
force every caller through a Result for a knob they can already reach.