Repository navigation
Validate twitch_oauth.txt session token before use - #5
Merged
Merged
Conversation
An expired or invalid session token in twitch_oauth.txt made streamlink fail with a generic "No playable streams found" error, which looks the same as the channel being offline. Add TwitchHelper.getSessionToken(), which reads the token and checks it against id.twitch.tv/oauth2/validate. On a 401 it logs an error, sends a system notification and returns undefined, so capture continues without auth instead of failing silently. Network errors during validation keep the token so a Twitch hiccup doesn't drop auth. - Live capture validates the token in a captureVideo() override before streamlink starts - VOD-at-end download uses the same helper - Scheduler checks the token every 6 hours so an expired one is reported before the next stream - Token censoring moved into the helper
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
An expired or invalid session token in
twitch_oauth.txtmakes streamlink fail with a genericNo playable streams found. That looks the same as the channel being offline, so the real cause is hidden.Changes
TwitchHelper.getSessionToken()reads the token and checks it againstid.twitch.tv/oauth2/validate. It doesn't touch the app token (accessToken).systemnotification and returnsundefined. Capture continues without auth (no ad-skip or sub-only access) instead of failing.censoredLogWordshere, replacing the per-call-site censoring.TwitchAutomator.captureVideo()override validates the token before streamlink starts, becauseproviderArgs()is sync.auth_enabledis on.notify.twitch-oauth-token-expired-or-invalid-check-config-twitch-oauth-txtkey, English only.Not included
captureTicker. There's no confirmed error string yet.Testing
Not typechecked or run locally because dependencies weren't installed. To verify: put a bad token in
twitch_oauth.txt, start a capture, and expect a "Twitch token invalid" notification with the recording still going.🤖 Generated with Claude Code