twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
72 stars 7 forks source link

Missing 403 Status for Send Extension PubSub Message #888

Open Marenthyu opened 5 months ago

Marenthyu commented 5 months ago

Brief description The Table listing possible Status Codes for the Send Extension PubSub Message Endpoint does not list 403 as a possible Status Code, but this response can be created when attempting to send a "global" message. Expected documentation The 403 Forbidden Error Code should be listed alongside the other Response Codes with an explanation of what was done wrong. Example returned Message:

{
    "error": "Forbidden",
    "status": 403,
    "message": "Error (403): Wrong channel requested"
}

Screenshots screenshot Additional context or questions This Example was caused due to me using the wrong JWT - so a correctly signed JWT was sent, but it was missing the required pubsub perms for the "global" Target.

Marenthyu commented 5 months ago

Additionally, the Following Message can also be returned:

{
    "error": "Forbidden",
    "status": 403,
    "message": "Error (403): JWT could not be verified"
}
Marenthyu commented 5 months ago

This mainly can happen when the developer in question does not realize that the JWT's "pubsub_perms" object is an object, not an array.

BarryCarlyon commented 5 months ago

This is somewhat already coveras the pubsub_perms in the onAuth JWT is formatted the same.

So you can decode the incoming JWT and pass the whole persub_perms over into a JWT generator. Which is a thing I've done in the past a few times.

Also this object is covered in existing JWT documentaiton:

https://dev.twitch.tv/docs/extensions/reference/#jwt-schema https://dev.twitch.tv/docs/extensions/reference/#example-jwt-payload

Wrong Channel request could occur for a number of things, usually yes it's a badly constructed JWT, but could be a parameter mismatch, but it's been a hot minute since I did a mismatch.

The docs here miss a lot of the possible 403s.