Skip to content

fix: send the session with Twitch requests - #18

Merged
Priveetee merged 3 commits into
mainfrom
fix/twitch-session-token
Nov 25, 2026
Merged

Priveetee merged 3 commits into
mainfrom
fix/twitch-session-token

Conversation

@Toastienergy

Copy link
Copy Markdown
Collaborator

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).

APIClient gets hasAccessToken (default false, so test stubs keep compiling). URLSessionAPIClient answers accessTokenProvider() != nil, the same rule URLSessionLiveChatTransport already uses for the Twitch chat stream. Guests still make the calls without a token.

Why

Reported on Apple TV: Twitch playback shows "Sign in again to continue." although the user is signed in and the Twitch account is linked. These endpoints were built with APIEndpoint's default requiresAuth: false, so they never sent Authorization. On an instance with guest access off, the Server answers 401 Authentication required (publicAccessOrRespond), which LiveUserError maps to .signInAgain. On instances with guests on, /twitch/live and /twitch/videos are relayed withUser, so without the session the linked Twitch account was never used for playback.

The shared sources are identical to the iOS app; this is the same commit as TypeType-Video/TypeType-IOS#104 (issue TypeType-Video/TypeType-IOS#103), whose CI (unit tests + build) passed.

Testing

Not built here (no Xcode). The iOS PR with the identical change compiled and passed its unit tests on CI. Not tried on an Apple TV.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants