#oauth

oauthcli

Implementation of OAuth 1.0 (and Twitter’s f*ckin’ OAuth) Client

20 releases (8 stable)

2.0.0-beta-2 Sep 3, 2017
2.0.0-beta-1 Jun 25, 2017
1.0.7 Jun 22, 2017
1.0.3 Jan 14, 2017
0.0.6 Feb 21, 2015

#31 in Authentication

Download history 33/week @ 2019-04-19 2/week @ 2019-04-26 33/week @ 2019-05-03 86/week @ 2019-05-10 47/week @ 2019-05-17 27/week @ 2019-05-24 53/week @ 2019-05-31 89/week @ 2019-06-07 1/week @ 2019-06-14 84/week @ 2019-06-21 42/week @ 2019-06-28 130/week @ 2019-07-05 36/week @ 2019-07-12 39/week @ 2019-07-19 25/week @ 2019-07-26

185 downloads per month
Used in 3 crates

MIT/Apache

24KB
506 lines

oauthcli

crates.io

Yet Another OAuth 1.0 Client Library for Rust

Features

  • RFC 5849 implementation (without RSA-SHA1)
  • Compatible with Twitter's (f*ckin') implementation

How to Use

extern crate oauthcli;
extern crate url;

let header =
  oauthcli::OAuthAuthorizationHeaderBuilder::new(
    "POST",
    url::Url::parse("https://example").unwrap(),
    "Consumer Key",
    "Consumer Secret",
    oauthcli::SignatureMethod::HmacSha1 // or Plaintext
  )
  .token("OAuth Token", "OAuth Token Secret")
  .request_parameters(vec![("status", "hello")].into_iter())
  .finish();

assert_eq!(header.to_string(), "OAuth ......")

Help me

oauthcli has already reached v1.0.0 although ring is not stable. What shoud I do for not breaking the compatibility?


lib.rs:

Yet Another OAuth 1.0 Client Library for Rust

Examples

Basic sample:

# extern crate url;
# extern crate oauthcli;
use oauthcli::*;
# fn main() {
let url = url::Url::parse("http://example.com/").unwrap();
let header =
    OAuthAuthorizationHeaderBuilder::new(
        "GET", &url, "consumer", "secret", SignatureMethod::HmacSha1)
    .token("token", "secret")
    .finish();
# }

If you use for Twitter, because of Twitter's bug, use finish_for_twitter method, and make sure to encode the request body with OAUTH_ENCODE_SET. For more detail, see this article (Japanese).

Dependencies

~8.5MB
~234K SLoC