# Need help about twitch.tv application

**URL:** <https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061>\
**Category:** Chat and IRC\
**Created:** [January 22, 2021, 4:52pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061 "2021-01-22T16:52:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 4:52pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/1 "2021-01-22T16:52:29Z")

</div>

Hello to everybody,  
I am new to [twitch.tv](http://twitch.tv), and my goal is to write a Telegram bot who check if a user is a subscriber of a particular twitch channel… I just registered a twitch app but I don’t know which OAuth redirect URL I have to specify.  
Could someone tell me its meaning ?  
Another question is related to the code… how to write the code which check if a user is registered to this channel ?  
Advanced thanks to everybody will help me.

---

<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:** [January 22, 2021, 4:54pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/2 "2021-01-22T16:54:41Z")

</div>

> [@Davide\_Vacca](#):
>
> I just registered a twitch app but I don’t know which OAuth redirect URL I have to specify.

That would be the URL/website you redirect the user to, to complete step 3 of regular user oAuth

Exchanging a code for an access (and refresh) tokens.

And thus the website that will talk to your key storage to store the keys for your bot to use.

> [@Davide\_Vacca](#):
>
> Another question is related to the code… how to write the code which check if a user is registered to this channel ?

This API references how to use the subscribers endpoint

> **[Reference](https://dev.twitch.tv/docs/api/reference/)**
>
> Twitch Developer tools and services to integrate Twitch into your development or create interactive experience on twitch.tv.

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:12pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/3 "2021-01-22T17:12:32Z")

</div>

Hello Barry,  
Thanks for reply me…  
Do you mean is the website where I want to redirect the response ?  
For example, if I want that the response will be redirected to [www.mywebsite.com](http://www.mywebsite.com); I have to write this URL ?  
Another question is related to tokens… I have not understood its meaning and, how to use it.  
Do you mean that, for my purpose, just enough an empty twitch app ?

---

<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:** [January 22, 2021, 5:16pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/4 "2021-01-22T17:16:01Z")

</div>

> [@Davide\_Vacca](#):
>
> Do you mean is the website where I want to redirect the response ?

oAuth in a nutshell

- Someone comes to your website, in order to grant access to your application to your Twitch account
- They click a link that takes them to twitch
- They accept (or deny) the application link (and any additional permissions or scopes)
- If they accept they come back to your website with a ?code
- You exchange the ?code for an access token/refresh token key pair
- You store (and use the keys)

> [@Davide\_Vacca](#):
>
> For example, if I want that the response will be redirected to [www.mywebsite.com](http://www.mywebsite.com); I have to write this URL ?

It’ll be the URL to the page/script that handles the final oAuth steps

> [@Davide\_Vacca](#):
>
> Another question is related to tokens… I have not understood its meaning and, how to use it.

An access token is “like a password” that you provide to the Twitch API that will confirm if you have the rights to read someones subscribers.

You provide the token as a header when making calls to the API

So to call the subscribers endpoint, you do as follows

```auto
curl -X GET 'https://api.twitch.tv/helix/subscriptions?broadcaster_id=123' \
-H 'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y' \
-H 'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'

```

From the docs, you send the Authorization token for the broadcaster `123` which’ll let you read the subscribers

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:21pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/5 "2021-01-22T17:21:42Z")

</div>

Hello again…  
In your last reply  
‘Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y’ and ‘Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2’ is the token I have to send in addressing my App ?  
How generate it ?  
Thanks again for you reply !!!

---

<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:** [January 22, 2021, 5:23pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/6 "2021-01-22T17:23:07Z")

</div>

Authentication is covered here.

> **[Authentication](https://dev.twitch.tv/docs/authentication/)**
>
> Authentication

The Client-ID is the clientID of your application you made on the dev console.

I already covered the “main steps”

> [@BarryCarlyon](#):
>
> oAuth in a nutshell
> 
> - Someone comes to your website, in order to grant access to your application to your Twitch account
> - They click a link that takes them to twitch
> - They accept (or deny) the application link (and any additional permissions or scopes)
> - If they accept they come back to your website with a ?code
> - You exchange the ?code for an access token/refresh token key pair
> - You store (and use the keys)

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:31pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/7 "2021-01-22T17:31:52Z")

</div>

Sorry, but I don’t understand a lot…  
My telegram bot send a request to my twich App, my App should check if the user is registered to a particular twich channel.  
So I am asking, how to write code ?  
I don’t have seen any editor for doing it.  
How exactly my twicht App should react ?  
Should my twitch App generate the tokens or, something else ?

---

<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:** [January 22, 2021, 5:34pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/8 "2021-01-22T17:34:01Z")

</div>

I’ve linked you the documentation.

> [@Davide\_Vacca](#):
>
> So I am asking, how to write code ?

I can provide fixes to code, but I’m not gonna write the code for you.

The next step is to pick a language and start programming.

There are some authentication examples on my github that might help you, but there are no practical examples you can jsut copy and paste

> <https://github.com/BarryCarlyon/twitch_misc/tree/main/authentication>
>
> //github.com/BarryCarlyon/twitch\_misc/tree/main/authentication

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:35pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/9 "2021-01-22T17:35:58Z")

</div>

Ok, thanks againg… I’ll give a look  
But, how to edit the code ? I really have any idea.

---

<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:** [January 22, 2021, 5:36pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/10 "2021-01-22T17:36:20Z")

</div>

> [@Davide\_Vacca](#):
>
> But, how to edit the code ? I really have any idea.

I do not understand your question

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:38pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/11 "2021-01-22T17:38:47Z")

</div>

Once created my twich App, then I have to code it… so I want know how to open editor and code it.  
From your github, it seems me I should use PHP language, right ?

---

<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:** [January 22, 2021, 5:40pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/12 "2021-01-22T17:40:01Z")

</div>

> [@Davide\_Vacca](#):
>
> From your github, it seems me I should use PHP language, right ?

You can use whatever programming language you want, my github has nodejs, php and pythong examples.

As long as the langauge can make cURL requests and serve webpages then you can built an app to authenticate users and make the relevant calls.

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:46pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/13 "2021-01-22T17:46:10Z")

</div>

Sorry, but I don’t really understand about anything…  
You are very polite, and it’s all my guilt; so I am asking if there is some tutorial to create a OAuth Twitch App from scratch… thanks again.

---

<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:** [January 22, 2021, 5:47pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/14 "2021-01-22T17:47:23Z")

</div>

If you don’t understand anything then first you need to learn the basics of a programming language

You need to learn to walk before you can run.

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 5:54pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/15 "2021-01-22T17:54:45Z")

</div>

I teach computer science in a high school, here in Italy; I wrote many applications in C#, C++, Java and PHP language… but Twich is absolutely new for me.  
For example, how to get tokens ?

---

<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:** [January 22, 2021, 5:55pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/16 "2021-01-22T17:55:46Z")

</div>

For a user access token which is what you would need to read subscribers

> [@BarryCarlyon](#):
>
> oAuth in a nutshell
> 
> - Someone comes to your website, in order to grant access to your application to your Twitch account
> - They click a link that takes them to twitch
> - They accept (or deny) the application link (and any additional permissions or scopes)
> - If they accept they come back to your website with a ?code
> - You exchange the ?code for an access token/refresh token key pair
> - You store (and use the keys)

> **[Getting OAuth Access Tokens](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/)**
>
> Getting OAuth Access Tokens

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 6:08pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/17 "2021-01-22T18:08:20Z")

</div>

What’s ‘?code’ ? I really don’t understand.  
Anyway is my twitch App should check if user is registered to a specified channel, not my website, which is external to twitch…

---

<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:** [January 22, 2021, 6:09pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/18 "2021-01-22T18:09:40Z")

</div>

> [@Davide\_Vacca](#):
>
> What’s ‘?code’ ? I really don’t understand.

?code is returned as the query string parameter when the user comes back to your website after accepting the application link

See step 2

 ![image](https://d2opxh93rbxzdn.cloudfront.net/original/2X/e/e8e662b6747c8b5200280c437ef0b992765944f4.png)

---

<div class="post-metadata">

**Author:** ![Davide\_Vacca](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/davide_vacca/32/11220_2.png) [@Davide\_Vacca](https://discuss.dev.twitch.com/u/Davide_Vacca)\
**Post date:** [January 22, 2021, 6:13pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/19 "2021-01-22T18:13:50Z")

</div>

Let me check if I have understood…  
Once user is succesfully autheticated in Twich, it returns to my website; but how could check if he/she is registered to a specified twich channel from here ?  
Only twich server should check it…

---

<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:** [January 22, 2021, 6:15pm UTC](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061/20 "2021-01-22T18:15:39Z")

</div>

> [@Davide\_Vacca](#):
>
> registered to a specified twich channel from here ?

Assuming by registered your mean “subscribed” as per your OP

> [@Davide\_Vacca](#):
>
> write a Telegram bot who check if a user is a subscriber of a particular twitch channel…

you will need an authentication token from the broadcaster that allows you to read their subscribers as documented

> **[Reference](https://dev.twitch.tv/docs/api/reference/)**
>
> Twitch Developer tools and services to integrate Twitch into your development or create interactive experience on twitch.tv.

[Next page](https://discuss.dev.twitch.com/t/need-help-about-twitch-tv-application/30061.md?page=2)
