plugins.twitch: use default UA on access-token req #6578
Merged
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 #6574
Simply set the default User-Agent when requesting an access token and ignore any custom User-Agent values set by the user.
I don't know why, but Twitch simply rejects access token requests when we don't set our default Firefox UA string. I've tried setting the HTTPSession's user-agent string (affected by user overrides) on the Chromium instance before retrieving the client-integrity token, and I also tried setting Chromium's User-Agent value on the HTTPSession after requesting the client-integrity token. None of that worked, in addition of course to the custom UA value from the CLI (a Chromium UA value).
This makes me believe that they are checking the HTTPSession's HTTPS connection (TLS handshakes and other specifics) in regards to the sent UA string.
So the solution for now is to simply discard custom user inputs and send the default FF UA when requesting an access token. This change depends on the previous commit on master. The plugin can therefore not be sideloaded unless the base Streamlink install is
>=7.4.0+17.g0360795c
master
PR