Crate oauth_client
source · [−]Expand description
OAuth 1.0 client library for Rust.
Examples
Send request for request token.
const REQUEST_TOKEN: &str = "http://oauthbin.com/v1/request-token";
let consumer = oauth_client::Token::new("key", "secret");
let bytes = oauth_client::get::<DefaultRequestBuilder>(REQUEST_TOKEN, &consumer, None, None, &()).unwrap();
Re-exports
pub use reqwest;
Structs
reqwest-blocking
Default one to use if you’re not using a custom HTTP Client and are ok with bundling reqwest
Token structure for the OAuth
Enums
Error type.
Errors possible while using parse_query_string
.
Things that can go wrong while verifying a request’s signature
Traits
Generic request type. Allows you to pass any reqwest::Request
-like object.
You’re gonna need to wrap whatever client’s Request
type you’re using in your own
type, as the orphan rules won’t allow you to impl
this trait.
A generic request builder. Allows you to use any HTTP client.
See DefaultRequestBuilder
for one that uses reqwest::Client
.
Functions
Create an authorization header. See https://dev.twitter.com/oauth/overview/authorizing-requests
Checks if the signature created by the given request data is the same as the provided signature.
Verifies that the provided request’s signature is valid.
The url_middleware
argument allows you to modify the url before it’s used to calculate the
signature. This could be useful for tests, where there can be multiple localhost
urls.
Send authorized GET request to the specified URL.
consumer
is a consumer token.
Utility function to parse the Authorization
header from an HTTP request.
Percent-encode the string in the manner defined in RFC 3986
Send authorized POST request to the specified URL.
consumer
is a consumer token.
Create signature. See https://dev.twitter.com/oauth/overview/creating-signatures
Type Definitions
Alias for HashMap<Cow<'a, str>, Cow<'a, str>>