Repository navigation
EBS: stop reporting valid credentials as rejected (403 Permission denied to use target) - #224
Merged
Merged
Conversation
The startup check sends a deliberately invalid target and read any 401/403 as "Twitch refused the credentials". Twitch verifies the token before it checks what the token may do, so credentials that are right get "403 Permission denied to use target" for that target, while wrong ones get "403 JWT could not be verified". Observed against the live endpoint on a server whose real broadcasts were succeeding (204) while the check, and so /healthz and the app's warning, still said rejected. A 403 with that message now counts as accepted; every other 401/403 is still a rejection. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 3
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After the extension secret and owner id were corrected on the server, real PubSub broadcasts returned 204 and the EBS was working — but the startup check (added in #220) still logged
Twitch REJECTED the EBS's PubSub credentials (403: ...Permission denied to use target),/healthzsaid"pubsub":"rejected", and the desktop app would show its Twitch warning. A false alarm that sent the operator chasing a problem that was already fixed.Cause
The check sends a deliberately invalid target and I had assumed Twitch answers that with
400when the credentials are good. Twitch actually verifies the token first and then checks what it may do, so the bogus target gets403 Permission denied to use targetfor valid credentials and403 JWT could not be verifiedfor wrong ones. The check treated every 403 as a refusal.Observed (live endpoint, from the server, secret never printed)
message, wrong key →400(body is validated before the token).204; raw-text key or numericuser_id→403 JWT could not be verified.403 JWT could not be verified; right secret →403 Permission denied to use target.Change
TwitchCredentialProbe: a403whose body saysPermission denied to use targetis accepted; every other401/403is still a rejection. Doc comment and README corrected to describe the real ordering.Verified
3 new tests (permission-denied → accepted, other 403 → rejected, 401 never accepted). EBS suite 217 passing, 0 build warnings. On the affected server, a real broadcast already flipped
/healthztoaccepted; this stops the startup check from reporting the opposite.🤖 Generated with Claude Code