async-oauth2
An async/await implementation of OAuth2 for Rust.
Documentation is available on docs.rs, or you can check out the working examples.
Examples
Note: oauth2_examples
below is a crate written to run the examples, you should
integrate it into whatever HTTP framework you are using.
use ;
use ;
async
If you want to run some of our pre-baked examples, you need to register an application that has a redirect URL of http://localhost:8080/api/auth/redirect
, then you can execute a flow like this:
cargo run --manifest-path=examples/Cargo.toml --bin spotify --client-id <client-id> --client-secret <client-secret>
cargo run --manifest-path=examples/Cargo.toml --bin google --client-id <client-id> --client-secret <client-secret>
cargo run --manifest-path=examples/Cargo.toml --bin twitch --client-id <client-id> --client-secret <client-secret>
Relationship to oauth2-rs
This is a fork of oauth2-rs
.
The main differences are:
- Removal of unecessary type parameters on Client (see discussion here).
- Only support one client implementation (reqwest).
- Remove most newtypes except
Scope
and the secret ones since they made the API harder to use.