Module client_credentials

Module client_credentials 

Source
Expand description

Client Credentials Flow


let client_resp = ClientAuthRequestBuilder::builder()
    .set_client_id(client_id)
    .set_client_secret(client_secret)
    .make_request()
    .await;

match client_resp {

    Ok(resp) => {
        let (token, expiration) = resp.into();
        eprintln!("Got Token {}. (Expires in {} seconds)", token, expiration);
    }

    Err(RequestError::MalformedRequest(msg)) =>
        unreachable!("We set all the parameters but the struct said {}", msg),

    Err(RequestError::ErrorCodes(code)) =>
        eprintln!("Server rejected request for reason {}", code),

    Err(e) =>
        eprintln!("Failed to make request for reason {}", e),

}

Structs§

ClientAuthRequest
Request for the client authentication flow.
See module level documentation for usage.
ClientAuthResponse
Response from a successful ClientAuthRequest
ClientAuthToken
Represents an authorization token header for requests