Git Product home page Git Product logo

oauth10a-rust's Introduction

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 may have bugs, so please an issue to fix the trouble.

Installation

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

oauth10a = { version = "^1.5.1", features = ["metrics"] }

Usage

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

use std::error::Error;

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

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
    let connector = ProxyConnectorBuilder::try_from_env()?;
    let client = Client::builder()
        .with_credentials(Credentials {
            token: "".to_string(),
            secret: "".to_string(),
            consumer_key: "".to_string(),
            consumer_secret: "".to_string(),
        })
        .build(connector);

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

    Ok(())
}

Features

name description
default Default enable features are client, logging, proxy
client The oauth 1.0a client implementation
logging Use the log facility crate to print logs
metrics Use once_cell and prometheus crates to register metrics
proxy Enable the support of environment variable http_proxy and https_proxy

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

License

See the license.

Getting in touch

oauth10a-rust's People

Contributors

florentindubois avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

icodein destenson

oauth10a-rust's Issues

Would it be possible to add HMAC-SHA1 support?

Hi,

Iโ€™m trying to use oauth10a to authenticate to Twitter. It appears that Twitter does not support SHA512 (tested it with others OAuth1.0a libraries, got the same result: 401 unauthorized).

Would it be possible to add SHA1 support or not?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.