PubSub: ERR_BADAUTH even if scope is ok

Hi,

I’m trying to listen to the channel-points-channel-v1 topic using pubsub. In the scope when generating my token, I’ve put channel:read:redemptions as stated in the documentation : https://dev.twitch.tv/docs/pubsub#topics .

But when i send the LISTEN message, the answer comes back with the error ERR_BADAUTH.

If I add “channel_read” in the scope, it works without the error. But this scope is deprecated from what I understand, and I don’t want those privileges, which I shouldn’t need.

Am I doing something wrong or am I missing something ? Or is it a bug in the API ?

Thanks

Did you use a user access token or a app access token?

The pubsub topics require a user access token.

response_type=code

This suggests you got an app access token in error. You need a token that represents the user/broadcast you wish to get events for

Thanks for the fast answer.

The token is a user access one, generated via the Implicit code flow. If I try a request to https://id.twitch.tv/oauth2/validate with the header Authorization: Bearer and the token, I’ve got a json response, with a login key and a value which is my username.

That would suggest you got a user access token for a different channel ID to the one you are trying to listen to

I’m using the endpoint : https://api.twitch.tv/kraken/channel to find the channel id. So it’s the right one. And if I only keep the following topic, I don’t have the error, and if I try a follow on my channel, I’ve got the message through pubsub which confirm it’s the right one.

Any idea ?

Is there another to find my channel id ? I’m using v5 api for that, which is deprecated. Maybe there’s something new ?

PubSub doesn’t have a following/follows topic.

User/Channel ID’s the same regardless of white API version you use.

So to confirm it is working with the “old scope” on the channel points topic but not the scope defined in the documentation?

Which doesn’t make sense since channel points is post Helix existing.

Edit: I tested I cannot replicate an issue. I generated a brand new access token for myself using the channel:read:redemptions scope and it booted right up.

So we need to check your code next

I used https://github.com/BarryCarlyon/twitch_misc/tree/master/pubsub to my pubsub and https://github.com/BarryCarlyon/twitch_misc/tree/master/authentication/implicit_auth to generate a token (modified the authorize URL)

Token validations

It seems it does. Try adding it and you’ll see you receive messages with the topic following.channelid .

I checked the code you gave here. Thanks a lot. And I replaced my v5 /channel api call with the helix /users one, and now it works without the old scope channel_read.

It seems ok now. Thanks a lot.

But can you check for the following topic please ?

It’s not in the documentation.

Therefore it is not supported for use by third party developers, and as such it can change or break at any time.

There is no officially supported topic for follows.

Helix/kraken makes no difference, when trying to listen to pubsub.

Both kraken/helix will return the same UserID/channelID.

So this shouldn’t make a difference when trying to listen on the channel points Topic. So I’m still unsure as to why you are having a issue.

Since I didn’t call helix or kraken at all in my calls

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