Repository navigation
fix: send the session with Twitch requests - #104
Merged
Merged
Conversation
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.
Fixes #103.
What
Twitch requests that guests may also make now send the session token when the user is signed in:
LiveTwitchService: lives, past broadcasts, chapters, clips, browse lists, search.LiveTwitchAccountService: chat assets, chat highlights, past-broadcast chat (/twitch/videos/{id}/comments).APIClientgetshasAccessToken(defaultfalse, so test stubs keep compiling).URLSessionAPIClientanswersaccessTokenProvider() != nil. This is the same ruleURLSessionLiveChatTransportalready uses for the Twitch chat stream (requiresAuth: client.accessTokenProvider() != nil). Guests still make the calls without a token.Why
These endpoints were built with
APIEndpoint's defaultrequiresAuth: false, so they never sentAuthorization. On an instance with guest access off, the Server answers401 Authentication requiredand the app shows "Sign in again to continue." for every live, VOD and clip, even though the user is signed in. On instances with guests on,/twitch/liveand/twitch/videosare relayedwithUser, so without the session the linked Twitch account was never used for playback (subscriber-only content, ad-free playback). Details in #103.Testing
Not built or run: written without Xcode. CI should compile it. Not tried on a device; the reporter will check on their instance (guest access off).
To check by hand: instance with guest access off, sign in, link Twitch, then open a live, a VOD (with chat) and a clip.
AI disclosure: this change was written with an AI coding assistant (Claude via Hermes Agent) at the reporter's request.