# 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:** 4

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [11월 27, 2019, 8:57오후 UTC](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149/4 "2019-11-27T20:57:35Z")

</div>

> [@Lucas\_Meijer](#):
>
> 헤드리스 WP 사이트를 구축하고 있습니다.

> [@Lucas\_Meijer](#):
>
> 하지만 이제 브라우저 콘솔에서 이 문제를 겪고 있습니다:

JavaScript 앱을 구축하고 브라우저에서 API 요청을 보내고 있는 것 같습니다.

권장되는 접근 방식은 Discourse 서버로 API 호출을 서버 측에서 수행하고, JavaScript 앱이 WordPress와 통신하는 방식과 동일하게 자체 서버와 통신하도록 하는 것입니다. 이렇게 하면 CORS 문제를 피할 수 있습니다.

---

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