Crate ezoauth

Source
Expand description

An easy to use OAuth2 client flow library based on oauth2-rs.

let config = ezoauth::OAuthConfig {
    auth_url: "https://discord.com/api/oauth2/authorize",
    token_url: "https://discord.com/api/oauth2/token",
    redirect_url: "http://localhost:8000",
    client_id: "...",
    client_secret: "...",
    scopes: vec!["identify"],
};
let (rx, auth_url) = ezoauth::authenticate(config, "localhost:8000")?;

println!("Browse to {}", auth_url);

let token = rx.recv().unwrap()?;

Structs§

OAuthConfig
Used to specify how you want to perform your OAuth authentication.
RefreshToken
Refresh token used to obtain a new access token (if supported by the authorization server).
Scope
Access token scope, as defined by the authorization server.
Token
A token response, which contains the access and refresh token as well as metadata like scopes, expiry info and the token type

Enums§

Error
The ezoauth error type
TokenType
Basic OAuth2 authorization token types.

Functions§

authenticate
The authenticate function performs the OAuth2 flow.