This crate has been deprecated due to merging with the eve_esi crate which offers a more complete, stable, and better documented OAuth2 API complete with proper caching & refreshing in addition to APIs for accessing ESI routes themselves.
The decision to merge the crates was made in order to share the same Client for better ease of use in regards to handling access & refresh tokens for authenticated ESI routes.
Implementation of an OAuth2 method for authenticating with EVE Online's SSO for use with your preferred Rust web framework.
- You will first need to create an application at https://developers.eveonline.com/.
- Set your callback URL in your application to the same one you will use in your application else you will encounter errors.
- localhost:8000/callback
- Select the scopes your application intends on using, add more later if needed.
- Create a .env file with your client id & client secret that you will use in your login & callback API routes.
You will need the following API routes:
- Login GET route to send the user to CCP's login page (
localhost:8000/login)- Call the
create_login_urlfunction to get the login link for the page - Store the state code returned from
create_login_urlin a session
- Call the
- Redirect GET route with code & state paramters (
localhost:8000/callback?code=...&state=...)- Validate state from session with the state code from the calback for additional security
- Call the
get_access_tokenfunction which uses the application client id & client secret & the code returned in the redirect to retrieve an access token - Call the
validate_access_tokenfunction to validate the token & to access the data within the token you can use in your application to verify the user
See the axum example to see the implementation above in action.
To test out the axum example:
- Copy .env.example to .env and fill out the variables which you can get from https://developers.eveonline.com/
- Run
cargo run --example axum - Login at
http://localhost:8000/login - On successful login you'll see your character id & name