An open API service indexing awesome lists of open source software.

https://github.com/jakobhellermann/ezoauth

Easy to use OAuth2 client for rust
https://github.com/jakobhellermann/ezoauth

Last synced: 11 months ago
JSON representation

Easy to use OAuth2 client for rust

Awesome Lists containing this project

README

          

# 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

```rust
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](mailto:jakob.hellermann@protonmail.com)