passport-google-oauth20에서의 profile mapping. - 바로가기
Google API Console
{
id: ~~~
displayName: ~~~
name: {
familyName: ~~,
givenName: ~~~~,
}
emails: [ { value: json.email, verified: json.email_verified } ]
photos: [{ value: json.picture || json.image.url }]
provider: google,
_raw: "", // JSON 문자열. _json과 동일하므로 생략
_json: {
sub: "~~~",
name: "~~~",
given_name: "~~",
family_name: "~",
picture: "~~~~~~",
email: "haebin.dev@gmail.com",
email_verified: true,
locale: "ko"
}
}
passport-naver에서의 profile mapping. - 바로가기
2021년 4월 13일 현재, naver는 사용자 이름을 'name'으로 제공하고 있으나 passport-naver에서는 'nickname'만을 profile.displayName와 profile._json.nickname에서 제공하고 있다. 이에 관한 issue도 있다.
필요하다면 Naver Developers에서 제공되는 정보의 종류도 확인하자.
// 수정 후
{
provider: naver
id: ~~~
displayName: ~~~
emails: [~~]
_json: {
email: "haebin_dev@naver.com",
nickname: "~~~",
profile_image: "~~~~~~",
age: ~~,
birthday: "~~~"
id: "~~~",
}
}
passport-kakao에서의 profile mapping. - 바로가기
Kakao Developers에 어떤 양식으로 어떤 정보를 제공하는지 잘 나와있으므로 가서 확인해보자.
{
provider: kakao
id: ~~~
displayName: ~~~
_json: {
id: ~~~,
connected_at: "2021-04-13T08:59:33Z",
properties: {
nickname: "~~~"
},
kakao_account: {
profile_needs_agreement: false,
profile: {
nickname: "~~~",
profile_image: "~~~",
},
has_email: true,
email_needs_agreement: false,
is_email_valid: true,
is_email_verified: true,
email: "haebin.dev@gmail.com"
}
}
}
google은 실명을, kakao는 별명을, naver는 둘 다 제공하고 있다.
하지만 naver의 경우 passport-naver에서 nickname만을 사용하고 있으므로 kakao와 차이가 없다고 보인다. 만약 실명이 필요한 경우에는 소셜 로그인 이후에 이름과 함께 본인 인증을 요구하는 방식을 추가하는 것을 고려해야할 것이다.