# Trying to subscribe to an EventSub using WebSockets gives an 403 error message

**URL:** <https://discuss.dev.twitch.com/t/trying-to-subscribe-to-an-eventsub-using-websockets-gives-an-403-error-message/62219>\
**Category:** Game Development\
**Created:** [January 7, 2025, 5:42pm UTC](https://discuss.dev.twitch.com/t/trying-to-subscribe-to-an-eventsub-using-websockets-gives-an-403-error-message/62219 "2025-01-07T17:42:53Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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 8, 2025, 12:08pm UTC](https://discuss.dev.twitch.com/t/trying-to-subscribe-to-an-eventsub-using-websockets-gives-an-403-error-message/62219/5 "2025-01-08T12:08:57Z")

</div>

> [@onecloneforall](#):
>
> I do not know if it is correct but I am using my channel ID for the _broadcaster\_user\_id_ (the ID, not the login name) and the ID of my app user for the _user\_id_ (the ID of the account I created in order to make the application I want to use in my game)

That sounds correct.

But thats not an “app id”, and app id is more the `client_id` than anything. Applications don’t have a user attached to them.

And the owner of the clientID is irrelevant.

> [@onecloneforall](#):
>
> I do not know if it is correct but I am using my channel ID for the _broadcaster\_user\_id_ (the ID, not the login name) and the ID of my app user for the _user\_id_

So your call looks like?

As it should of worked, as long as the `user_id` is the ID of the user you have authenticated as.  
And the target channel doesn’t have the user you are reading chat as banned.

But this is irrelevant to your use case (as a game running client side).

You authed in as `bob` you should be able to connect to whichever channel you want, (as long as `bob` is not banned in that channel, and you are below the concurrent join limit)

> [@onecloneforall](#):
>
> Perhaps there is something I do not understand but the channel ID and the user ID of the token are the same for me.

To connect to your own channel to read chat, that would be correct

> [@onecloneforall](#):
>
> I have just used the same ID (the channel ID) for both _broadcaster\_user\_id_ and _user\_id_ and now it works. Shame on me because I have not tried it before!

This type `channel.chat.message` works as follows

conditions:

- broadcaster\_user\_id - the chat you want to read
- user\_id - the user you want to read chat as and thus oAuth’ed as.

> [@onecloneforall](#):
>
> However, I do not understand why it works. In every part of the API I cannot find this solution and I was thinking that it could not have been like this. If you are up to it, please, can you explain why does it work?

(For Straight websockets)

Becuase you authenticated as `bob` and said `I want to read chat as bob` and then said `I want to read the chat channel of bob`

And you only have the permission of `bob`

`bob` here being the user you oAuth-enticated as (not but could be the owner of the application)

So for example for conduits

I `barrycarlyon` of ID `15185913` own `b2z6u6b4sg6p84d3pq1ykcehlk1vhh9`  
I get `cohhcarnage` of ID `26610234` to authenticate to that clientID  
And I get the channelbot `CohhilitionBot` of ID `45522171` to authentcate to that ClientID

Now the bot `45522171` can connect to `26610234` channel via conduits, (as in this example I’m using condiuts)

And my ID (the owner of the application) comes up no where.

> [@BarryCarlyon](#):
>
> You can cross reference what you are doing with this example: [EventSub WebSockets Chat edition with Implicit Auth Example](https://barrycarlyon.github.io/twitch_misc/eventsub/websockets/web/chat/)

Thats why I linked my reference example I wrote so you can compare

> [@onecloneforall](#):
>
> (the ID of the account I created in order to make the application I want to use in my game)

So here when using websockets you’ll only be able to authenticate as the broadcaster playing the game.

So I would, in my game,

- present an oAuth prompt
- authenticate the broadcaster with _chat read only scopes not send_
- connect to and read chat as the broadcaster, so `broadcaster_user_id` and `user_id` are the same, as I’m connecting to the broadcasters chat as the broadcasters
- send any prompts or nudges for chat to do things _in_ the game via video not via chat, so I don’t have to request write scopes.

The person running the game will only have the permissions of themself available and no other users.

---

_[View the full topic](https://discuss.dev.twitch.com/t/trying-to-subscribe-to-an-eventsub-using-websockets-gives-an-403-error-message/62219)._
