Microservice using OAuth 2.0 and OpenID Connect to authenticate with Google and get user information.
- Java 17+
- Maven
- Spring Boot 4.0
- Spring Security 7
- OAuth2 Client
- AngularJS, HTML, CSS
- Go to https://console.cloud.google.com and login with your Google account
- Create a new project or select an existing one
- Navigate to "APIs & Services" → "Credentials" → "Create Credentials" → "OAuth client ID"
- Application Type: "Web Application"
- Authorized redirect URIs:
http://localhost:8181/login/oauth2/code/google - Copy the Client ID and Client Secret
Copy the example config and add your credentials:
cp src/main/resources/application-local.yml.example src/main/resources/application-local.ymlEdit application-local.yml with your Client ID and Client Secret.
mvn spring-boot:run -Dspring-boot.run.profiles=localAlternative: use environment variables instead of application-local.yml:
export GOOGLE_CLIENT_ID=your-client-id
export GOOGLE_CLIENT_SECRET=your-client-secret
mvn spring-boot:runNavigate to http://localhost:8181
Click "Google Login" to authenticate with your Google account.