Giter Club home page Giter Club logo

haver's Introduction

Haver (๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ)

๊ฒ€์ƒ‰ API์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•˜๋‚˜์š”?

๋Œ€๊ตฌ์†Œํ”„ํŠธ์›จ์–ด๊ณ ๋“ฑํ•™๊ต๋ผ๋Š” ํ‚ค์›Œ๋“œ๋กœ ๊ฒ€์ƒ‰์„ ํ• ๋ ค๊ณ  ํ• ๋ ค๋ฉด,

https://dapi.kakao.com/v2/search/web?query=๋Œ€๊ตฌ์†Œํ”„ํŠธ์›จ์–ด๊ณ ๋“ฑํ•™๊ต&size=10

์ด๋Ÿฐ์‹์œผ๋กœ ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•˜๋ฉด ๋œ๋‹ค.

ํ•˜์ง€๋งŒ ์ด๋Ÿฐ์‹์œผ๋กœ ์š”์ฒญ์„ ํ•˜๊ฒŒ ๋˜๋ฉด,

{
  "errorType": "AccessDeniedError",
  "message": "cannot find Authorization : KakaoAK header"
}

์ด๋Ÿฐ์‹์˜ ๋ฉ”์‹œ์ง€๊ฐ€ ๋‚˜์˜ค๊ฒŒ ๋ ํ…๋ฐ... message๋ฅผ ์ž˜ ๋ณด๋ฉด

cannot find Authorization : KakaoAK header

๋ผ๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ๋œจ๊ฒŒ ๋˜๋Š” ๋ชจ์Šต์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ์•ˆ์€ ๊ฐ„๋‹จํ•˜๋‹ค.

๊ทธ์ € header์— KakaoAK๋ฅผ ๊ฐ™์ด ์ „์†กํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

KakaoAK๋Š” ์–ด๋””์„œ ๋ฐœ๊ธ‰๋ฐ›๋‚˜์š”?

๋งํฌ์—์„œ ๋กœ๊ทธ์ธ -> ๋‚ด ์—ํ”Œ๋ฆฌ์ผ€์ด์…˜ -> ๋“ฑ๋ก์„ ํ•˜์‹œ๋ฉด ์š”์•ฝ ์ •๋ณด์— ์•ฑ ํ‚ค๋ผ๋Š” ๊ฒƒ์ด ๋ฐœ๊ธ‰์ด ๋ ๊ฒƒ์ด๋‹ค! ๊ทธ๊ณณ์—์„œ ์ž์‹ ์ด ํ•„์š”ํ•œ APIํ‚ค๋ฅผ ๊ฐ€์ ธ๋‹ค ์“ฐ๋ฉด ๋˜๋Š”๋ฐ, ๋‚˜๋Š” REST APIํ‚ค๋ฅผ ๊ฐ€์ ธ๋‹ค๊ฐ€ ์“ธ๊ฒƒ์ด๋‹ค.

KakaoAK์˜ ํ˜•์‹์€

"API_KEY": "KakaoAK + (๋ฐœ๊ธ‰๋ฐ›์€ API_KEY)"

์˜ ํ˜•์‹์œผ๋กœ ํ—ค๋”์— ์ „์†ก๋งŒ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. ์ฆ‰, ๋‚˜์ค‘์— axios๋ฅผ ํ†ตํ•œ ์„œ๋ฒ„APIํ†ต์‹ ์„ ์ง„ํ–‰ํ• ๋•Œ,

import { API_KEY } from 'config/config.json';

...

customAxios.get(`${SERVER}${query}`, {
  headers: {
    Authorization: API_KEY,
  },
});

์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

haver's People

Contributors

hong-junhyeok avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.