PubSub, ERR_BADAUTH please help me

error message:
{“type”:“RESPONSE”,“error”:“ERR_BADAUTH”,“nonce”:“asdasdasd”}

ı create token for link https://twitchapps.com/tokengen/
client id : true
scopes: channel_subscriptions

I’m entering the incoming token but I’m getting an error

type to nodejs

`const WebSocket = require(‘ws’)

const ws = new WebSocket(‘wss://pubsub-edge.twitch.tv’)

ws.on(‘open’, () => {

ws.send(JSON.stringify({

    type: 'LISTEN',

    nonce: 'asdasdasd',

    data: {

      topics: ['channel-subscribe-events-v1.xxx'],

      auth_token: 'xxx'

    }

  }));

});

ws.on(‘message’,(message)=>{

console.log(message)

})`

Where am I doing wrong

clientID can’t be true it needs to be a real clientID

aside from that, you seem to have created a token correctly using this tool.

So you either tried to connect to a different userID’s subscriptions feed than is in the token
Or the token died.

‘clintid true’
The client id I entered was correct.
I recreated it and got the same error.

Then you are either misformatting the token

Or you are trying to read, say liriks subs when your key belongs to ninja for example

The token needs to have the userID you specified in channel-subscribe-events-v1.xxx

Then the token you have is not valid for userID 19571641

You should be able to use the token to call

The userID you specified belongs to Ninja, so Ninja will have needed to have authenticated, and I don’t think Ninja will have authenticated an implict auth key for you, I’m guess you have authenticated

And you don’t not have access to Ninja’s subs.

The UserID of the Token needs to match the userID in the topic

okey sir, the channel where I try to withdraw subscriber information must send me your token

Correct.

And for that you don’t want to be using someones token generator.

As when the token dies they have to do it all over again.

You should build your own authentication flow to get both the user and refresh tokens.

So you can use the refresh token to get a new access token

Usually this flow

understood. I will create a post and create a new token every time it opens.

Something like this happens when I write my own ID. Is it because this channel is offline?

image

“error: no respons from Twitch” is not a valid Error from the basic websockets modules.

I don’t know what raised that error

okey sir, maybe because the subscription is not active, I will try it on a channel with subscription active.
Keep this place open for information I will return here.

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