# 使用 JavaScript fetch 将 Discourse 的公开页面获取到外部站点 (Discourse API)

**URL:** <https://meta.discourse.org/t/using-javascript-fetch-to-get-publicly-available-page-from-discourse-into-an-external-site-discourse-api/261062>\
**Category:** Product Support\
**Created:** [2023 年4 月 9 日 00:05 UTC](https://meta.discourse.org/t/using-javascript-fetch-to-get-publicly-available-page-from-discourse-into-an-external-site-discourse-api/261062 "2023-04-09T00:05:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

作者： ![gassim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gassim/32/220910_2.png) [@gassim](https://meta.discourse.org/u/gassim)\
发布日期： [2023 年4 月 10 日 22:34 UTC](https://meta.discourse.org/t/using-javascript-fetch-to-get-publicly-available-page-from-discourse-into-an-external-site-discourse-api/261062/3 "2023-04-10T22:34:38Z")

</div>

感谢 @pfaffman！这解决了问题。我之前添加了 API 密钥标头，这导致了错误的出现，但在删除 API 密钥并进行常规的 fetch 请求后，它就起作用了。👍👍

---

_[View the full topic](https://meta.discourse.org/t/using-javascript-fetch-to-get-publicly-available-page-from-discourse-into-an-external-site-discourse-api/261062)._
