hi-hyein / nyangterest

react project nyang-terest
2 stars 1 forks source link

[social login]google social login test #267

Closed hi-hyein closed 4 years ago

hi-hyein commented 4 years ago

passport-google-oauth20 모듈을 사용하여 직접 구현하여 테스트 하면서 분석,설계 문서 업데이트

hi-hyein commented 4 years ago

Request data

회원가입/로그인 진행 후 전략을 실행하여 인증에 성공했을 때 받아오는 profile object

 {
   id: 'number',
   displayName: '정혜인',
   name: { familyName: '정', givenName: '혜인' },
   emails: [ { value: 'address', verified: true } ],
   photos: [
     {
       value: 'https://lh3.googleusercontent.com/-laUJEz72MSk/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclQJfLoKb7UWxIOHQUMDq7PQVdcRA/photo.jpg'
     }
   ],
   provider: 'google',
   _raw: '{\n' +
     '  "sub": "number",\n' +
     '  "name": "정혜인",\n' +
     '  "given_name": "혜인",\n' +
     '  "family_name": "정",\n' +
     '  "picture": "https://lh3.googleusercontent.com/-laUJEz72MSk/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclQJfLoKb7UWxIOHQUMDq7PQVdcRA/photo.jpg",\n' +
     '  "email": "address",\n' +
     '  "email_verified": true,\n' +
     '  "locale": "ko"\n' +
     '}',
   _json: {
     sub: 'number',
     name: '정혜인',
     given_name: '혜인',
     family_name: '정',
     picture: 'https://lh3.googleusercontent.com/-laUJEz72MSk/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclQJfLoKb7UWxIOHQUMDq7PQVdcRA/photo.jpg',
     email: 'address',
     email_verified: true,
     locale: 'ko'
   }
 }

사용자가 구글 로그인에 성공했을 때 /google/callback 으로 받는 request (관련있는 부분만 추림)

query: {
  code: 'number',
  scope: 'email profile https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email openid',
  authuser: '0',
  prompt: 'consent'
},
hi-hyein commented 4 years ago

로그인 & 회원가입

회원가입

넘어가는 정보들은 객체로 묵어 post로 보내는 것으로 수정할 것
hi-hyein commented 4 years ago

271 이어서 진행