์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ

์†Œ์…œ ๋กœ๊ทธ์ธ

dev_summer 2024. 1. 22. 13:27

kakao

1. ์ธ๊ฐ€ ์ฝ”๋“œ ๋ฐ›๊ธฐ

get https://kauth.kakao.com/oauth/authorize?client_id=clientId&redirect_uri=http://localhost:8000&response_type=code

 

์นด์นด์˜ค๊ณ„์ •

 

accounts.kakao.com

 

2. ํ† ํฐ๋ฐ›๊ธฐ

post https://kauth.kakao.com/oauth/token

grant_type : authorization_code

client_id : ํด๋ผ์ด์–ธํŠธ ์•„์ด๋””

redirect_uri : ๋ฆฌํ„ด url

code : ์ธ๊ฐ€ ์ฝ”๋“œ

 

3. ์ •๋ณด ์กฐํšŒ

post https://kapi.kakao.com/v2/user/me

bearer token

ex)

data: {
    id: 1,
    connected_at: '2023-07-31T09:46:36Z',
    properties: {
      nickname: '',
      profile_image: '',
      thumbnail_image: ''
    },
    kakao_account: {
      profile_nickname_needs_agreement: false,
      profile_image_needs_agreement: false,
      profile: [Object],
      name_needs_agreement: false,
      name: '',
      has_email: true,
      email_needs_agreement: false,
      is_email_valid: true,
      is_email_verified: true,
      email: '',
      has_phone_number: true,
      phone_number_needs_agreement: false,
      phone_number: '+82',
      has_birthyear: true,
      birthyear_needs_agreement: false,
      birthyear: '',
      has_birthday: true,
      birthday_needs_agreement: false,
      birthday: '',
      birthday_type: 'SOLAR'
    }
  }

 

 

naver

 

1. ์ธ๊ฐ€ ์ฝ”๋“œ ๋ฐ›๊ธฐ

get https://nid.naver.com/oauth2.0/authorize?client_id=clientId&response_type=code&redirect_uri=http://localhost:8000

 

https://nid.naver.com/oauth2.0/authorize?client_id=n0cxfGmaN5L13rcILyYp&redirect_uri=http%3A%2F%2Flocalhost%3A8000&response_type=code

 

nid.naver.com

 

2. ํ† ํฐ ๋ฐ›๊ธฐ

get https://nid.naver.com/oauth2.0/token?grant_type=authorization_code&client_id=n0cxfGmaN5L13rcILyYp&client_secret=์‹œํฌ๋ฆฟํ‚ค

 

 

3. ์ •๋ณด ๋ฐ›๊ธฐ

post https://openapi.naver.com/v1/nid/me

bearer token

ex)

{
    "resultcode": "00",
    "message": "success",
    "response": {
      "id": "",
      "nickname": "summer",
      "age": "",
      "gender": "",
      "email": "",
      "mobile": "",
      "mobile_e164": "",
      "birthday": "",
      "birthyear": ""
    }
}

google

1. ์ธ๊ฐ€ ์ฝ”๋“œ ๋ฐ›๊ธฐ

get https://accounts.google.com/o/oauth2/v2/auth?client_id=clientId&redirect_uri=http://localhost:8000&response_type=code&scope=email+profile+openid

 

๋กœ๊ทธ์ธ - Google ๊ณ„์ •

๊ณ„์† ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด Google์—์„œ ๋‚ด ์ด๋ฆ„, ์ด๋ฉ”์ผ ์ฃผ์†Œ, ์–ธ์–ด ํ™˜๊ฒฝ์„ค์ •, ํ”„๋กœํ•„ ์‚ฌ์ง„์„ StyleRecipe๊ณผ(์™€) ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

accounts.google.com

(scpoe๊ฐ€ ๋ฐ›์•„์˜ฌ ์ •๋ณด ๋ชฉ๋ก)

 

2. ํ† ํฐ ๋ฐ›๊ธฐ

post https://oauth2.googleapis.com/token

code : ์ธ๊ฐ€์ฝ”๋“œ (%2F ⇒ / ๋กœ ์น˜ํ™˜ํ•ด์•ผํ•จ)

client_id : ํด๋ผ์ด์–ธํŠธ ์•„์ด๋””

client_secret : ํด๋ผ์ด์–ธํŠธ ํ‚ค

redirect_uri : uri

grant_type: authorization_code

 

3. ํ† ํฐ์œผ๋กœ ์ •๋ณด ๋ฐ›๊ธฐ

์ด๋ฆ„, ์ด๋ฉ”์ผ, ์†Œ์…œ ์•„์ด๋””

์˜ˆ์ œ

{
    "iss": "",
    "azp": "",
    "aud": "",
    "sub": "",
    "email": "",
    "email_verified": true,
    "at_hash": "",
    "name": "",
    "picture": "",
    "given_name": "",
    "family_name": "",
    "locale": "",
    "iat": ,
    "exp": 
}