๊ณต์‚ผ
article thumbnail


๐Ÿ’ฌ ๋“ค์–ด๊ฐ€๋ฉฐ

 

๊ณต๋ชจ์ „ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•˜๋ฉฐ ์œ„๋„, ๊ฒฝ๋„ ๊ฐ’์„ ์ด์šฉํ•˜๋Š” ๋ถ€๋ถ„์ด ์žˆ์–ด Geolocation์„ ํ†ตํ•ด ์œ„๋„ ๊ฒฝ๋„ ๊ฐ’์„ ๋ฐ›์•„์™€ ์‚ฌ์šฉ์ค‘์ด์—ˆ๋‹ค.

์ด๋ฒˆ์—” ํ˜„์žฌ์œ„์น˜๋ฅผ ๋„์›Œ์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด ์ƒ๊ฒจ ๋ฐ›์•„์™”๋˜ ์œ„๋„, ๊ฒฝ๋„ ๊ฐ’์„ ์ด์šฉํ•ด ์ƒ์„ธ ์ฃผ์†Œ๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๋ฐฉ๋ฒ•์„ ๊ณต์œ ํ•ด๋ณธ๋‹ค.

 

 

โ“ ๋ฌธ์ œ ์ƒํ™ฉ

 

Cannot find Authorization : KakaoAK header

kakao API ๋ฅผ ์ด์šฉํ•ด ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ๋“ค์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ์‹์€ ๋‹ค๋ฅธ ๋ธ”๋กœ๊ทธ๋“ค, ๊ณต์‹ ๋ฌธ์„œ ๋“ฑ์— ์ž์„ธํžˆ ๋‚˜์™€์žˆ๋‹ค. ๋”ฐ๋ผํ•˜๋˜ ์™€์ค‘ ๊ณ„์†ํ•ด์„œ  ์œ„์™€๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. 

 

์ดˆ๊ธฐ์—๋Š” 401 ์˜ค๋ฅ˜์ž์ฒด๊ฐ€ ๊ถŒํ•œ ๋ฌธ์ œ๋ผ๋Š” ์ƒ๊ฐ์— ๋‚ด Key๊ฐ’, IP, ํ˜ธ์ŠคํŠธ ์ฃผ์†Œ์„ค์ •๋“ฑ์ด ๋ฌธ์ œ์ธ์ค„ ์•Œ๊ณ  ๋ป˜์ง“์„ ํ•˜๋‹ค๊ฐ€. ๋‹ค๋ฅธ๋ถ„์ด ์ž‘์„ฑํ•˜์‹  ์งˆ๋ฌธ ๊ธ€์„ ๋ณด๊ณ  ํ˜•์‹์ด ์ž˜๋ชป๋œ ๊ฒƒ์„ ์•Œ์•˜๋‹ค. 

 

 

๐Ÿ’ก ๋ฌธ์ œ ํ•ด๊ฒฐ

 

 const fetchAddress = async () => {
        try {
          const response = await axios.get(`https://dapi.kakao.com/v2/local/geo/coord2address.json?input_coord=WGS84&x=${longitude}&y=${latitude}`, {
            headers: {
              Authorization: '๋‚ด Rest Key ๊ฐ’',
            },
          });

์ด๋Ÿฐ ์‹์œผ๋กœ header ์— ํ•ด๋‹น ํ‚ค๊ฐ’๋งŒ ์ ์šฉํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. 

 

const response = await axios.get(`https://dapi.kakao.com/v2/local/geo/coord2address.json?input_coord=WGS84&x=${longitude}&y=${latitude}`, {
            headers: {
              Authorization: 'KakaoAK' + ' ' + '๋‚ด Rest API ํ‚ค๊ฐ’',
            },
          });

 

์œ„์™€ ๊ฐ™์ด ๋„์–ด์“ฐ๊ธฐ ๊นŒ์ง€ ํ™•์‹คํžˆ ์ ์šฉํ•ด์ค˜์•ผ ํ•œ๋‹ค. 

 

์ด๋ ‡๊ฒŒ ํ•ด๋„ ์•ˆ๋œ๋‹ค๋ฉด, ์ฒ˜์Œ์— ๋‚ด๊ฐ€ ํ–ˆ๋˜ ๋ป˜์ง“๊ณผ ๊ฐ™์ด IP, ๋“ฑ๋ก๋œ ์ฃผ์†Œ ๋“ฑ์„ ํ™•์ธํ•ด ๋ณด๊ธธ ๋ฐ”๋ž€๋‹ค.

 

์‚ฌ์ดํŠธ ๋„๋ฉ”์ธ ํ™•์ธ

์นด์นด์˜ค ๋””๋ฒจ๋กญ -> ๋‚ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ -> ์•ฑ์„ค์ • -> ํ”Œ๋žซํผ -> Web ์‚ฌ์ดํŠธ ๋„๋ฉ”์ธ ํ™•์ธ 

 

 

๐Ÿ“š ๋งˆ์น˜๋ฉฐ

 

ํ•œ์ฐธ์„ ํ—ค๋ฉ”๊ณ  ์„ฑ๊ณตํ•œ๋’ค ๋ณด๋ฉด ๋ณ„๊ฑฐ ์•„๋‹Œ ๊ฑธ๋กœ ํ•ญ์ƒ ์‹œ๊ฐ„์„ ๋ณด๋ƒˆ๋‹ค. ์ด๋ฒˆ์—๋„ ํ—ˆ๋ฌดํ•˜๊ณ  ์„ฑ๊ณต์ ์ธ ๊ฒฐ๊ณผ์™€ ํ•จ๊ป˜ ๊ณต์‹๋ฌธ์„œ ํ™•์ธ์„ ์ž˜ํ•˜์ž๋Š” ๊ตํ›ˆ์„ ๋ฐฐ์šฐ๊ณ  ๊ฐ„๋‹ค.

 

 


๐Ÿ”— ์ฐธ๊ณ 

https://developers.kakao.com/docs/latest/ko/local/dev-guide#address-coord

 

Kakao Developers

์นด์นด์˜ค API๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•ด๋ณด์„ธ์š”. ์นด์นด์˜ค ๋กœ๊ทธ์ธ, ๋ฉ”์‹œ์ง€ ๋ณด๋‚ด๊ธฐ, ์นœ๊ตฌ API, ์ธ๊ณต์ง€๋Šฅ API ๋“ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

developers.kakao.com

https://devtalk.kakao.com/top?period=weekly 

 

์นด์นด์˜ค ๋ฐ๋ธŒํ†ก

์นด์นด์˜ค ๋ฐ๋ธŒํ†ก. ์นด์นด์˜ค ํ”Œ๋žซํผ ์„œ๋น„์Šค ๊ด€๋ จ ์งˆ๋ฌธ ๋ฐ ๋‹ต๋ณ€์„ ์˜ฌ๋ฆฌ๋Š” ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ ์‚ฌ์ดํŠธ์ž…๋‹ˆ๋‹ค.

devtalk.kakao.com

 

 

 

profile

๊ณต์‚ผ

@g_three

ํฌ์ŠคํŒ…์ด ์ข‹์•˜๋‹ค๋ฉด "์ข‹์•„์š”โค๏ธ" ๋˜๋Š” "๊ตฌ๋…๐Ÿ‘๐Ÿป" ํ•ด์ฃผ์„ธ์š”!