OAuth 1.0a crate

This crate provides an oauth 1.0a client implementation fully-async with logging, metrics and tracing facilities. It was firstly designed to interact with the Clever-Cloud's api, but has been extended to be more generic.

Status

This crate is under development, you can use it, but it may have bugs or unimplemented features.

Installation

To install this dependency, just add the following line to your Cargo.toml manifest.

toml oauth10a = { version = "^1.0.0", features = ["telemetry"] }

Usage

Below, you will find an example of executing a simple request to an api.

```rust use std::error::Error;

use oauth10a::client::{Client, Credentials, RestClient};

[tokio::main]

async fn main() -> Result<(), Box> { let client = Client::from(Credentials { token: "".tostring(), secret: "".tostring(), consumerkey: "".tostring(), consumersecret: "".tostring(), }));

let _obj: BtreeMap<String, String> = client.get("https://example.com/object.json").await?;

Ok(())

} ```

Features

| name | description | | --------- | ------------------------------------------------------------- | | client | The oauth 1.0a client implementation | | logging | Use the log facility crate to print logs | | metrics | Use lazy_static and prometheus crates to register metrics |

Metrics

Below, the exposed metrics gathered by prometheus:

| name | labels | kind | description | | -------------------------------- | --------------------------------------------------------------- | ------- | -------------------------- | | oauth10aclientrequest | endpoint: String, method: String, status: Integer | Counter | number of request on api | | oauth10aclientrequest_duration | endpoint: String, method: String, status: Integer, unit: String | Counter | duration of request on api |

License

See the license.

Getting in touch