rocket_oauth2
helps set up OAuth 2.0 sign-in or authorization 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, Cookies, SameSite}; use rocket::Request; use rocket::response::Redirect; use rocket_oauth2::{OAuth2, TokenResponse};
struct GitHub;
fn githublogin(oauth2: OAuth2
fn githubcallback(token: TokenResponse
fn main() {
rocket::ignite()
.mount("/", routes![githubcallback, githublogin])
.attach(OAuth2::
Rocket.toml
)toml
[global.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: