Skip to content

TwiN/spring-security-oauth2-client-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-security-oauth2-client-example

Modules

minimal-sample

This module contains the minimal configuration required for a Spring Boot project using Spring Security with OAuth2 client.

custom-userservice-sample

Same as minimal-sample, but it contains a custom OAuth2 UserService.

Note

For Google, it's actually possible to just use the two following properties:

spring.security.oauth2.client.registration.google.client-id=
spring.security.oauth2.client.registration.google.client-secret=

But for the sake of the example, I'll be inserting all properties.

Creating the API credentials

create credentials

  • Select Web Application
  • Add http://localhost as Authorised JavaScript origins
  • Add http://localhost/login/oauth2/code/google as Authorised redirect URIs

oauth-client-id-parameters

  • Click on Create
  • Copy your client ID and your client secret as the value for spring.security.oauth2.client.registration.google.client-id and spring.security.oauth2.client.registration.google.client-secret respectively in the application.properties file.
  • Done

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages