joeyak / go-twitch-eventsub

MIT License
3 stars 4 forks source link

Invalid transport and auth combination #4

Closed ensiouel closed 1 year ago

ensiouel commented 1 year ago

Hi, when trying to subscribe to stream events online or offline, I get an error could not subscribe to event: 400 Bad Request: {"error":"Bad Request","status":400,"message":"invalid transport and auth combination"} even when I try to execute the code from your example.

As a result, I am sending a completely correct json {"type":"stream.online","version":"1","condition":{"broadcaster_user_id":"842366340"},"transport":{"method":"websocket","session_id":"AgoQXqCqQ0RlS0-1URVxCmlCUBIGY2VsbC1j"}}

The error is not in client_id, access_token or user_id and the code is 1 in 1 as in your example

joeyak commented 1 year ago

What type of auth token are you using? WebHook eventsub subscriptions require an app token, but Websocket eventsub subscriptions require a user access token. This is what I use for my bot that uses this package. https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#authorization-code-grant-flow

When I get an app access token I also got

ERROR: could not subscribe to event: 400 Bad Request: {"error":"Bad Request","status":400,"message":"invalid transport and auth combination"}

ensiouel commented 1 year ago

Indeed, I mistakenly used the application token, not the user. Thank you for correcting me!