Function remoteit_api::auth::build_auth_header

source ·
pub fn build_auth_header<'__f0, '__f1, '__f2, '__f3, '__f4, '__f5>() -> BuildAuthHeaderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, '__f5>
Expand description

You probably don’t want to use this function directly, unless you are implementing your own abstraction over the remote.it API.

Create the value to use in the Authorization header for requests to the remote.it API.

This function is used by [R3Client::send_remoteit_graphql_request] and [R3Client::send_remoteit_graphql_request_async] to authorize requests to the remote.it API.

§Returns

A String which should be set as the value for the Authorization header for sending requests to the remote.it API.

§Example

use reqwest::Method;
use remoteit_api::Credentials;
use remoteit_api::GRAPHQL_PATH;
let credentials = Credentials::load_from_disk().call().unwrap().take_profile("default").unwrap().unwrap();
let date = remoteit_api::auth::get_date();
let auth_header = remoteit_api::auth::build_auth_header()
    .key_id(credentials.access_key_id())
    .key(credentials.key())
    .content_type("application/json")
    .method(&Method::POST)
    .path(GRAPHQL_PATH)
    .date(&date)
    .call();