먼저 Naver 로그인 API Key를 발급해야하는데 다음 포스트를 확인하면 쉽게 발급할 수 있다.
application-oauth.yml
spring: security: oauth2: client: registration: naver: client-id: Client ID client-secret: Client Secret redirect-uri: {baseUrl}/{action}/oauth2/code/{registrationId} authorization-grant-type: authorization_code scope: name,email,profile_image client-name: Naver provider: naver: authorization-uri: https://nid.naver.com/oauth2.0/authorize token-uri: https://nid.naver.com/oauth2.0/token user-info-uri: https://openapi.naver.com/v1/nid/me user-name-attribute: response spring.security.oauth2.client.provider.naver.authorization-uri=
application-oauth.properties
spring.security.oauth2.client.registration.naver.client-id=Client ID spring.security.oauth2.client.registration.naver.client-secret=Client Secret spring.security.oauth2.client.registration.naver.redirect-uri={baseUrl}/{action}/oauth2/code/{registrationId} spring.security.oauth2.client.registration.naver.authorization-grant-type=authorization_code spring.security.oauth2.client.registration.naver.scope=name,email,profile_image spring.security.oauth2.client.registration.naver.client-name=Naver spring.security.oauth2.client.provider.naver.authorization-uri=https://nid.naver.com/oauth2.0/authorize spring.security.oauth2.client.provider.naver.token-uri=https://nid.naver.com/oauth2.0/token spring.security.oauth2.client.provider.naver.user-info-uri=https://openapi.naver.com/v1/nid/me spring.security.oauth2.client.provider.naver.user-name-attribute=response