#oauth

oauth1

Basic OAuth1 library for Rust

4 releases (1 stable)

1.0.0 Jan 12, 2020
0.3.0 Oct 19, 2017
0.2.0 Oct 18, 2017
0.1.0 Oct 18, 2017

#98 in #oauth

Download history 55/week @ 2024-07-21 62/week @ 2024-07-28 77/week @ 2024-08-04 75/week @ 2024-08-11 51/week @ 2024-08-18 48/week @ 2024-08-25 40/week @ 2024-09-01 44/week @ 2024-09-08 82/week @ 2024-09-15 102/week @ 2024-09-22 68/week @ 2024-09-29 71/week @ 2024-10-06 72/week @ 2024-10-13 36/week @ 2024-10-20 33/week @ 2024-10-27 29/week @ 2024-11-03

188 downloads per month
Used in 2 crates

MIT/Apache

7KB
93 lines

OAuth1

Basic OAuth1 library for Rust.

Usage

extern crate oauth1;
extern crate reqwest;

use oauth1::Token;
use reqwest::Client;
use reqwest::header::Authorization;

pub fn main() {
    let client = Client::new();
    let url = "https://api.twitter.com/1.1/account/verify_credentials.json";
    let res = client.get(url)
        .header(Authorization(oauth1::authorize(
            "GET",
            url,
            &Token::new("consumer_key", "consumer_secret"),
            Some(&Token::new("auth_token", "auth_token_secret")),
            None,
        )))
        .send().unwrap();
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~11MB
~302K SLoC