OAuth: Google Setup
Setting up a Google OAuth App to obtain client id and client secret
How to set up Google OAuth
- Navigate to https://developers.google.com/identity/sign-in/web/sign-in to create a Google OAuth Application.
-
If you are asked “Where are you calling from”, select “Web Server”
-
Set the Authorized Redirect URI to:
http://localhost:8080/login/oauth2/code/google
-
- Add the following items to your
localhost.json
file, filling out theclient-id
andclient-secret
with the values from your Google OAuth application:"spring.security.oauth2.client.registration.google.client-id":"ENTER-GOOGLE-ID", "spring.security.oauth2.client.registration.google.client-secret":"ENTER-GOOGLE-SECRET"
- NOTE: If you want Heroku to also support Google OAuth, you’ll need to do the same in
heroku.json
, hopefully with a set of production credentials from a production Google OAuth app.
- NOTE: If you want Heroku to also support Google OAuth, you’ll need to do the same in
- Run
source env.sh
to update your environment. - Run
mvn -P localhost spring-boot:run
and see that your application is now configured to support Google OAuth!.
Related topics:
- OAuth: —The way we implement the 'login with Google, Facebook, or Github' thing you see on some websites
- OAuth: Authorizing GitHub Third Party Apps—Gradescope, and GitHub OAuth Apps you build yourself
- OAuth: GitHub Setup—Setting up a GitHub OAuth App to obtain client id and client secret
- OAuth: Google Setup—Setting up a Google OAuth App to obtain client id and client secret