matrix_sdk::oidc::requests::token

Function request_access_token

Source
pub async fn request_access_token(
    http_service: &BoxCloneSyncService<Request<Bytes>, Response<Bytes>, Box<dyn Error + Send + Sync>>,
    client_credentials: ClientCredentials,
    token_endpoint: &Url,
    request: AccessTokenRequest,
    now: DateTime<Utc>,
    rng: &mut impl Rng,
) -> Result<AccessTokenResponse, TokenRequestError>
Available on crate feature experimental-oidc only.
Expand description

Request an access token.

§Arguments

  • http_service - The service to use for making HTTP requests.

  • client_credentials - The credentials obtained when registering the client.

  • token_endpoint - The URL of the issuer’s Token endpoint.

  • request - The request to make at the Token endpoint.

  • now - The current time.

  • rng - A random number generator.

§Errors

Returns an error if the request fails or the response is invalid.