Crates.io | ezoauth |
lib.rs | ezoauth |
version | 0.2.0 |
source | src |
created_at | 2020-10-02 12:36:22.037218 |
updated_at | 2022-01-05 09:55:40.825802 |
description | Easy to use OAuth2 client for rust |
homepage | |
repository | https://github.com/jakobhellermann/ezoauth |
max_upload_size | |
id | 295339 |
size | 37,693 |
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
.
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()?;
MIT © Jakob Hellermann