# "401 Unauthorized" despite access token being passed

**URL:** <https://discuss.dev.twitch.com/t/401-unauthorized-despite-access-token-being-passed/27513>\
**Category:** API\
**Created:** [August 4, 2020, 8:32pm UTC](https://discuss.dev.twitch.com/t/401-unauthorized-despite-access-token-being-passed/27513 "2020-08-04T20:32:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![AlexanderHaffer](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@AlexanderHaffer](https://discuss.dev.twitch.com/u/AlexanderHaffer)\
**Post date:** [August 4, 2020, 9:31pm UTC](https://discuss.dev.twitch.com/t/401-unauthorized-despite-access-token-being-passed/27513/2 "2020-08-04T21:31:01Z")

</div>

Found the fix on [another API-related issue](https://discuss.dev.twitch.com/t/unauthorized-401-client-id-and-oauth-token-do-not-match/27488) and now it works. Thanks to @BarryCarlyon! 🙂

For other people with the same issue:

```
curl_setopt($curl, CURLOPT_HEADER, array(
    'Authorization: Bearer '.TWITCH_ACCESS_TOKEN,
    'Client-ID: '.TWITCH_CLIENT_ID
));

```

has to be:

```
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer '.TWITCH_ACCESS_TOKEN,
    'Client-ID: '.TWITCH_CLIENT_ID
));
```

---

_[View the full topic](https://discuss.dev.twitch.com/t/401-unauthorized-despite-access-token-being-passed/27513)._
