# Is there a way to get chatters via bearer token?

**URL:** <https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909>\
**Category:** API\
**Created:** [April 18, 2019, 11:07am UTC](https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909 "2019-04-18T11:07:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Reginald](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/peter_reginald/32/6060_2.png) [@Peter\_Reginald](https://staging-discuss.dev.twitch.com/u/Peter_Reginald)\
**Post date:** [April 18, 2019, 11:07am UTC](https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909/1 "2019-04-18T11:07:06Z")

</div>

I’m creating a browser source for OBS that fetches a streamer’s followers, subs and chatters. My browser source works perfectly locally on the loopback address but I get CORS exception when loading the same browser source after pushing it to firebase.

I discovered that I was getting CORS error because [tmi.twitch.tv](http://tmi.twitch.tv) does not allow a call to the `https://tmi.twitch.tv/group/user/<channelName>/chatters` end point client side from a webpage.

> Since [tmi.twitch.tv](http://tmi.twitch.tv/) is not intended for use by 3rd party devs it does not support CORS (access-control-allow-origin header) thus it cannot be accessed directly by a browser Javascript application. You will need to “proxy” the request through a server-side script if you need that data in Javascript. [source](https://staging-discuss.dev.twitch.com/t/tmi-twitch-tv-json/15102)

This is my block of code to fetch all the chatters for a given channel.

```
function getChatters(channelName) {
  var settings = {
    async: true,
      crossDomain: true,
      url: 'https://tmi.twitch.tv/group/user/' + channelName + '/chatters',
      method: 'GET'
  };
  $.ajax(settings).done(function(response) {
    $('p#chatters').prepend(response.chatters.viewers.join(', '));
    $('p#moderators').prepend(response.chatters.moderators.join(', '));
  });
}

```

Is there any way to get chatters via bearer token?

I use firebase + firestore.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 18, 2019, 11:08am UTC](https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909/2 "2019-04-18T11:08:52Z")

</div>

> [@Peter\_Reginald](#):
>
> Is there any way to get chatters via bearer token?

No

The chatters endpoint is technically unofficial and doesn’t support CORS as you already found, hence your CORS issue.

You’d have to bounce it via a proxy as you already noted.

---

<div class="post-metadata">

**Author:** ![Peter\_Reginald](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/peter_reginald/32/6060_2.png) [@Peter\_Reginald](https://staging-discuss.dev.twitch.com/u/Peter_Reginald)\
**Post date:** [April 18, 2019, 11:12am UTC](https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909/3 "2019-04-18T11:12:12Z")

</div>

boom that was fast, thanks @BarryCarlyon

Off to cloud functions it is then.

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [May 18, 2019, 11:12am UTC](https://staging-discuss.dev.twitch.com/t/is-there-a-way-to-get-chatters-via-bearer-token/20909/4 "2019-05-18T11:12:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
