matrix_sdk::oidc::requests::client_credentials

Function access_token_with_client_credentials

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

Exchange an authorization code for an access token.

This should be used as the first step for logging in, and to request a token with a new scope.

§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.

  • scope - The scope to authorize.

  • now - The current time.

  • rng - A random number generator.

§Errors

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