# Cannot custom headers in webpage when call external API (outside HubSpot)

**URL:** <https://community.hubspot.com/t/cannot-custom-headers-in-webpage-when-call-external-api-outside-hubspot/30256>\
**Category:** CMS Development\
**Tags:** html, professional\
**Created:** [January 15, 2021, 6:24am UTC](https://community.hubspot.com/t/cannot-custom-headers-in-webpage-when-call-external-api-outside-hubspot/30256 "2021-01-15T06:24:55Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [January 25, 2021, 5:26pm UTC](https://community.hubspot.com/t/cannot-custom-headers-in-webpage-when-call-external-api-outside-hubspot/30256/15 "2021-01-25T17:26:01Z")

</div>

Ok, that would suggest the Access-Control-Allow-Origin is set to wildcard (\*) i.e. code from any origin can access the API. As it states, you can’t have credentials when that is set to wildcard. What do you get if you remove credentials?

```lia-code-sample
fetch("https://external_domain/api", {
 method: 'GET',
 headers: {
 'Content-Type': 'application/x-www-form-urlencoded',
 'Authorization': 'Bearer ' + [your token]
 }
})
.then(response => {
 console.log(response.data);
})

```

---

_[View the full topic](https://community.hubspot.com/t/cannot-custom-headers-in-webpage-when-call-external-api-outside-hubspot/30256)._
