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 ready for production. If you find a bug, please open an issue.
Installation
To install this dependency, just add the following line to your Cargo.toml
manifest.
= { = "^2.1.2", = ["metrics"] }
Usage
Below, you will find an example of executing a simple request to an API.
use ;
type MyData = BTreeMap;
type MyError = String;
async
Features
name | description |
---|---|
default | Default enable features are client and logging |
execute | Provides the ExecuteRequest trait |
client | Provides an HTTP client that implements ExecuteRequest handling request's authorization |
logging | Use the log facility crate to print logs |
metrics | Use prometheus crate to register metrics |
tracing | Use tracing crate to add tracing::instrument on functions |
rest | Enables RESTful API helper methods |
sse | Enables streaming Server-Sent Events (SSE) |
serde | Provides serde implementation for Credentials |
zeroize | Provides zeroize::Zeroize implementations on Credentials |
Metrics
Below, the exposed metrics gathered by prometheus:
name | labels | kind | description |
---|---|---|---|
oauth10a_client_request | endpoint: String, method: String, status: Integer | Counter | number of request on API |
oauth10a_client_request_duration | endpoint: String, method: String, status: Integer, unit: String | Counter | duration of request on API |
oauth10a_client_sse | endpoint: String | Counter | number of events received from API |
License
See the license.