# fetch를 통해 API에 접근할 때 API 키로 인증하기

**URL:** <https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [11월 22, 2019, 12:32오후 UTC](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149 "2019-11-22T12:32:59Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Lucas\_Meijer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lucas_meijer/32/157389_2.png) [@Lucas\_Meijer](https://meta.discourse.org/u/Lucas_Meijer)\
**Post date:** [11월 28, 2019, 7:10오전 UTC](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149/5 "2019-11-28T07:10:40Z")

</div>

아, 최고네요! 덕분에 [WP Discourse](https://github.com/discourse/wp-discourse) 코드를 살펴보다가, 제가 원하시는 API 엔드포인트(즉, Discourse 댓글을 API로 노출하는 것)를 WordPress가 노출하도록 하려면 옵션 하나만 바꾸면 된다는 걸 깨달았어요. 조금만 수정하면 되니 정말 좋습니다. 정말 감사합니다 🙂

궁금한 게 있는데, 왜 클라이언트 측에서 Discourse API를 직접 호출하는 걸 권장하지 않는 건가요? 나중에 예산이 확보되면 로그인 기능 같은 걸로 프로젝트를 확장할 계획이 있어서, 그 경우에도 Discourse API와 통신하고 싶습니다. 모든 요청을 WordPress를 통해 라우팅해야 하나요? 🙂

---

_[View the full topic](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149)._
