Crate oauth_client

Source
Expand description

OAuth 1.0 client library for Rust.

Repository

§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§

DefaultRequestBuilderreqwest-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.
ParseQueryError
Errors possible while using parse_query_string.
VerifyError
Things that can go wrong while verifying a request’s signature

Traits§

GenericRequest
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.
RequestBuilder
A generic request builder. Allows you to use any HTTP client. See DefaultRequestBuilder for one that uses reqwest::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 multiple localhost 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§

ParamList
Alias for HashMap<Cow<'a, str>, Cow<'a, str>>