소셜 로그인

사용자의 회원가입 및 로그인 시 편의성을 위하여 Google, Kakao 를 이용한 소셜 로그인 사용

#Google
spring.security.oauth2.client.registration.google.client-name=google
spring.security.oauth2.client.registration.google.client-id={Google_ID}
spring.security.oauth2.client.registration.google.client-secret={Google_SECRET}
spring.security.oauth2.client.registration.google.scope=profile,email
spring.security.oauth2.client.registration.google.redirect_uri=http://localhost:9999/api/v1/login/oauth2/code/google

#Kakao
spring.security.oauth2.client.registration.kakao.client-name=kakao
spring.security.oauth2.client.registration.kakao.client-id={Kakao_ID}
spring.security.oauth2.client.registration.kakao.client-secret={Kakao_SECRET}
spring.security.oauth2.client.registration.kakao.scope=profile_nickname, account_email
spring.security.oauth2.client.registration.kakao.redirect-uri=http://localhost:9999/api/v1/login/oauth2/code/kakao
spring.security.oauth2.client.registration.kakao.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.kakao.client-authentication-method=client_secret_post
spring.security.oauth2.client.provider.kakao.authorization-uri=https://kauth.kakao.com/oauth/authorize
spring.security.oauth2.client.provider.kakao.token-uri=https://kauth.kakao.com/oauth/token
spring.security.oauth2.client.provider.kakao.user-info-uri=https://kapi.kakao.com/v2/user/me
spring.security.oauth2.client.provider.kakao.user-name-attribute=id

구글 개발자 센터

카카오 개발자 센터

  1. 각 개발자 센터에서 애플리케이션 생성 후 발급받은 ID와 SECRET을 properties에 등록합니다.
  2. 인증을 받은 redirectURI와 제공받을 사용자 정보의 범위 또한 등록합니다.
  3. Google의 경우 Spring Security에서 Oauth 과정이 원활히 진행되도록 세팅 되어 있지만, Kakao의 경우 추가적인 설정을 properties에 작성해 주어야 합니다.