# Create a PUBSUB app, beginner

**URL:** <https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173>\
**Category:** API\
**Created:** [September 15, 2020, 4:02pm UTC](https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173 "2020-09-15T16:02:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexthe2](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/alexthe2/32/10225_2.png) [@alexthe2](https://discuss.dev.twitch.com/u/alexthe2)\
**Post date:** [September 15, 2020, 4:02pm UTC](https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173/1 "2020-09-15T16:02:01Z")

</div>

Hello everyone,  
I got asked to create a channel points listener for a friend. I went on and created that listener with python websockets and the PubSub API. Now here comes the thing where I have no idea:

How to generate an OAuth? I know you can create your application in the Console but even then, how can I get the Chat ID and a Token.  
If there is any tutorial or guide I would be fine with it, but I can’t seem to get a breakthrough.

---

<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:** [September 15, 2020, 4:27pm UTC](https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173/2 "2020-09-15T16:27:38Z")

</div>

Authentication is covered here

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

You should probably generate a user access token

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

There is a Node and PHP example at

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

That might be of use

TLDR:

- Create a URL that goes to Twitch specifiying your client ID and the required scopes. (and other fields)
- Get the streamers to click that link
- They go to Twitch, they accept the connection between your Application and their account
- They are redirected to your website with a `code`
- Exchange the `code` for an access and refresh token

Then use that access token to connect to pubsub, and refresh the token when the access token dies/you get disconnected from PubSub.

---

<div class="post-metadata">

**Author:** ![alexthe2](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/alexthe2/32/10225_2.png) [@alexthe2](https://discuss.dev.twitch.com/u/alexthe2)\
**Post date:** [September 15, 2020, 6:50pm UTC](https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173/3 "2020-09-15T18:50:31Z")

</div>

Ok, thank you I will look into it

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [October 15, 2020, 6:50pm UTC](https://discuss.dev.twitch.com/t/create-a-pubsub-app-beginner/28173/4 "2020-10-15T18:50:31Z")

</div>

Closed on October 15, 2020, 6:50pm UTC

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