axum-google-oauth
is a barebones example implementation of the oauth-axum
crate for authenticating with the Google OAuth 2.0 API and retrieving user information.
More information about this crate can be found in the crate documentation.
- Create an OAuth 2.0 Client ID and Client Secret in the Google Cloud Platform Console by following these instructions. See here.
- Clone the repository.
- Copy the
.env.example
file, rename it to.env
, and copy across your Client ID and Client Secret obtained in step 1. - Modify the implementation to suit your requirements.
- Perform
cargo run
in the repository.- Use cargo watch to enable live reloading.
- Make a GET request to the
create_url
endpoint:curl http://localhost:3000/
- Open the returned URL in your browser.
- Login to your google account.
- See the user information in the callback.