2 unstable releases
0.2.0 | Jan 5, 2022 |
---|---|
0.1.0 | Oct 2, 2020 |
#971 in Authentication
12KB
144 lines
ezoauth
An easy to use OAuth2 client for rust
The crate automatically starts a webserver in a background thread and makes the authorization flow a simple matter of calling ezoauth::authenticate
with your OAuthConfig
.
Example Usage
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()?;
LICENSE
MIT © Jakob Hellermann
lib.rs
:
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()?;
Dependencies
~6–19MB
~263K SLoC