rocket_oauth2
helps set up an OAuth 2.0 client in Rocket
applications.
For more detailed examples and explanations, see the crate documentation and the
projects in the repository's examples
directory.
```rust use rocket::http::{Cookie, CookieJar, SameSite}; use rocket::Request; use rocket::response::Redirect; use rocket_oauth2::{OAuth2, TokenResponse};
struct GitHub;
fn githublogin(oauth2: OAuth2
fn githubcallback(token: TokenResponse
fn rocket() -> _ {
rocket::build()
.mount("/", routes![githubcallback, githublogin])
.attach(OAuth2::
Rocket.toml
)toml
[default.oauth.github]
provider = "GitHub"
client_id = "..."
client_secret = "..."
redirect_uri = "http://localhost:8000/auth/github"
rocket_oauth2
is licensed under either of the following, at your option: