TwitchDropsMiner icon indicating copy to clipboard operation
TwitchDropsMiner copied to clipboard

v15: Client ID <-> cookie auth token client ID mismatch

Open DevilXD opened this issue 1 year ago • 1 comments

Hello o/

This is more or less an informational announcement type of an issue, that I realized I have to make here to hopefully try and delay the inevitable, which is the new login method stopping working.

There's a small issue with the latest master build, that was introduced with the recent login method fix. For now, my solution is to just give you an exception telling you that you've been impacted by it.

The issue

The authorization token has a client ID associated to it, which can be seen when asking the OAuth verification endpoint for it's validity. This may sounds fine at first glance, but the current master branch just changed it's (pretty much harcoded) client ID to a different one, which now results in - for people who are still using their old and working android app cookie - sending in a SmartTV client ID with an android app authorization token. This client ID "mismatch" can be easily detected on Twitch side, and potentially cause trouble (new login method stopping working) very quickly.

The immediate solution

To prevent "red lamps" lighting up on the Twitch side and telling them that something's weird going on, I've just pushed https://github.com/DevilXD/TwitchDropsMiner/commit/348d039b282fa97654020457527137cf0a53ebd1. This is the simplest thing I can do for now, to stop it from happening as early as I can.

The long-term solution

The best solution going forward would be to:

  • Redesign the cookie file system to try and put it into a more externally-manageable format than pickling it (JSON).
  • To each authentication token stored in this "new cookie file", associate it's Client ID, to prevent mismatching it later on.
  • Implement a way for the miner to read and dynamically change the user agent used for the client ID the cookie contains.

What to do when you get the error

There's two things you can do, each one having it's pros and cons:

  • Do what the error says and just login via the new method.
    • The old cookie can/should be backed up, since it still works.
    • Doable on either source code or executable versions.
    • Simplest way to avoid the error.
  • Modify the source code to switch back to it using the android client ID.
    • Lets you stay on the existing cookie file.
    • Doable only on the source code version, but can be built into an executable afterwards.
    • Harder to perform, requires modifying the source code.

The overall good news is that the modification is quite simple - you just need to change this line ending of twitch.py from SMARTBOX to ANDROID: https://github.com/DevilXD/TwitchDropsMiner/blob/348d039b282fa97654020457527137cf0a53ebd1/twitch.py#L89 Alternatively, you can download the android branch source code and avoid doing any modifications yourself: TwitchDropsMiner@android

Additional purpose

In addition to being informational, I'll use this issue to track progress regarding reworking the login method per the "long-term solution" section above. I'd like to release v15 before doing so though, as it's been delayed by way longer than I wanted. You can expect a release soon.

DevilXD avatar Dec 24 '22 09:12 DevilXD

Sin título Thanks for all the work, for the moment it works correctly and in Spanish :D

matarife123 avatar Dec 25 '22 11:12 matarife123