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;
client-reqwest
Structs§
- Default
Request Builder reqwest-blocking
- Default one to use if you’re not using a custom HTTP Client and are ok with bundling reqwest
- Token
- Token structure for the OAuth
Enums§
- Error
- Error type.
- Parse
Query Error - Errors possible while using
parse_query_string
. - Verify
Error - Things that can go wrong while verifying a request’s signature
Traits§
- Generic
Request - Generic request type. Allows you to pass any
reqwest::Request
-like object. You’re gonna need to wrap whatever client’sRequest
type you’re using in your own type, as the orphan rules won’t allow you toimpl
this trait. - Request
Builder - A generic request builder. Allows you to use any HTTP client.
See
DefaultRequestBuilder
for one that usesreqwest::Client
.
Functions§
- authorization_
header - Create an authorization header. See https://dev.twitter.com/oauth/overview/authorizing-requests
- check_
signature - Checks if the signature created by the given request data is the same as the provided signature.
- check_
signature_ request - 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 multiplelocalhost
urls. - get
- Send authorized GET request to the specified URL.
consumer
is a consumer token. - parse_
query_ string - Utility function to parse the
Authorization
header from an HTTP request. - percent_
encode_ string - Percent-encode the string in the manner defined in RFC 3986
- post
- Send authorized POST request to the specified URL.
consumer
is a consumer token. - signature
- Create signature. See https://dev.twitter.com/oauth/overview/creating-signatures
Type Aliases§
- Param
List - Alias for
HashMap<Cow<'a, str>, Cow<'a, str>>