pub struct OAuth<'a> {
pub client: &'a Client,
}
Expand description
The Oauth Service is used to request access to the API
Fields§
§client: &'a Client
Implementations§
source§impl OAuth<'_>
impl OAuth<'_>
Exchange the short-lived authorization code for an access token you can use to authenticate your API calls.
Examples
use dnsimple::dnsimple::new_client;
use dnsimple::dnsimple::oauth::OAuthTokenPayload;
let client = new_client(true, String::from("AUTH_TOKEN"));
let payload = OAuthTokenPayload {
client_id: "id".to_string(),
client_secret: "secret".to_string(),
code: "code".to_string(),
redirect_uri: "/redirect_uri".to_string(),
state: "state".to_string()
};
let access_token = client.oauth().exchange_authorization_for_token(payload);
Attributes
payload
: The OAuthTokenPayload
with the necessary information to get the access token.