# Get Channel ID where the extension is currently displayed

**URL:** <https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583>\
**Category:** Extensions\
**Created:** [July 12, 2018, 6:25pm UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583 "2018-07-12T18:25:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flai](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/flai/32/4764_2.png) [@flai](https://discuss.dev.twitch.com/u/flai)\
**Post date:** [July 12, 2018, 6:25pm UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583/1 "2018-07-12T18:25:45Z")

</div>

Hi everyone,

how do I get the name (or preferably the ID) of the channel that my extension is embedded in?

At the moment I do the following:

```auto
  window.Twitch.ext.onAuthorized((auth) => {
    log('Live on channel', auth.channelId);
    window.TwitchChannelId = auth.channelId;
    main();
  });

```

However, I’m not confident that this will work for non-logged-in users. Is this the recommended way, or is there a better way?

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 13, 2018, 7:53am UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583/2 "2018-07-13T07:53:15Z")

</div>

Not sure it works? Test it!

ChannelID is always returned in the auth callback

---

<div class="post-metadata">

**Author:** ![flai](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/flai/32/4764_2.png) [@flai](https://discuss.dev.twitch.com/u/flai)\
**Post date:** [July 13, 2018, 1:34pm UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583/3 "2018-07-13T13:34:27Z")

</div>

Thank you, I have tested it.

Does this also work for non-logged-in users? I have no way to test that before the extension is approved.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 13, 2018, 2:45pm UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583/4 "2018-07-13T14:45:57Z")

</div>

Good point. Hand’t had coffee yet 😛

You can test a logged out view with the developer rig

[https://github.com/twitchdev/developer-rig](https://github.com/twitchdev/developer-rig)

The only difference between logged out, logged in not authed, logged in auth, is if a UserID is returned and what kind of opaqueID you get.

The channelID is always returned.

---

<div class="post-metadata">

**Author:** ![flai](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/flai/32/4764_2.png) [@flai](https://discuss.dev.twitch.com/u/flai)\
**Post date:** [July 13, 2018, 3:46pm UTC](https://discuss.dev.twitch.com/t/get-channel-id-where-the-extension-is-currently-displayed/16583/5 "2018-07-13T15:46:58Z")

</div>

Thanks you for your help!

I don’t have the dev-rig set up for the extension I’m developing, as I’m integrating heavily with the video on stream, so I didn’t even know that was a feature.
