Struct inth_oauth2_async::client::Client[][src]

pub struct Client<P> {
    pub provider: P,
    pub client_id: String,
    pub client_secret: String,
    pub redirect_uri: Option<String>,
}
Expand description

OAuth 2.0 client.

Fields

provider: P

OAuth provider.

client_id: String

Client ID.

client_secret: String

Client secret.

redirect_uri: Option<String>

Redirect URI.

Implementations

Creates a client.

Examples

use inth_oauth2_async::Client;
use inth_oauth2_async::provider::google::Installed;

let client = Client::new(
    Installed,
    String::from("CLIENT_ID"),
    String::from("CLIENT_SECRET"),
    Some(String::from("urn:ietf:wg:oauth:2.0:oob")),
);

Returns an authorization endpoint URI to direct the user to.

See RFC 6749, section 3.1.

Examples

use inth_oauth2_async::Client;
use inth_oauth2_async::provider::google::Installed;

let client = Client::new(
    Installed,
    String::from("CLIENT_ID"),
    String::from("CLIENT_SECRET"),
    Some(String::from("urn:ietf:wg:oauth:2.0:oob")),
);

let auth_uri = client.auth_uri(
    Some("https://www.googleapis.com/auth/userinfo.email"),
    None,
);

Requests an access token using an authorization code.

See RFC 6749, section 4.1.3.

Refreshes an access token.

See RFC 6749, section 6.

Ensures an access token is valid by refreshing it if necessary.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.