강의

멘토링

커뮤니티

Inflearn Community Q&A

No author

This post's author information has been deleted.

Spring Boot Security & JWT Lecture

Spring Boot Security 11 - Naver Login Completed

안녕하세요! 질문있습니당!

Written on

·

408

0

11강 네이버 로그인까지 완료하고 @AuthenticationPrincipal을 이용해서 로그인한 정보를 가져오려고 하는데, 구글로 로그인했을 때는 정보가 출력되는데, 네이버로 로그인했을 때는 null로 나와서 구글링하며 찾아보았는데 해결이 안 되어서…. 질문 남깁니다.

springspring-securityoauth2

Answer 1

0

metacoding님의 프로필 이미지
metacoding
Instructor

oauth 요청한뒤 회원정보 받아올때, 그 정보 변수에 있는것을 console에 출력해보세요.

아마 property(속성) 값이 다를거에요.

 

네이버 (캡쳐)

구글 (캡쳐)

 

여기에 사진 올려주시겠어요?

스크린샷 2024-02-26 오후 2.22.41.png스크린샷 2024-02-26 오후 2.27.36.png스크린샷 2024-02-26 오후 2.28.19.png

console에 출력한 결과입니다!!

metacoding님의 프로필 이미지
metacoding
Instructor

image

이게 네이버는 response 객체안에 email이 있고

 

구글은 바로 email이 있어서, 파싱을 다르게 해야할것 같아요

감사합니다!!
스크린샷 2024-02-26 오후 5.49.13.png

이렇게 PrincipalDetails에 다르게 넣어주었습니다. 그 결과, 카카오는 Authentication객체에 잘 담기는데, 네이버는 PrincipalDetails이 null이라고 나옵니다.

No author

This post's author information has been deleted.

Ask a question