Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #234
DevilXD opened this issue Dec 24, 2022 · 2 comments
Closed
Tracked by #234

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

DevilXD opened this issue Dec 24, 2022 · 2 comments
Labels
Dev For interminent issues created during development between releases Solved This issue has been resolved

Comments

@DevilXD
Copy link
Owner

DevilXD commented Dec 24, 2022

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 348d039. 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:

CLIENT_ID, USER_AGENT = ClientType.SMARTBOX

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 DevilXD added Critical For critical issues that prevent the application from working Dev For interminent issues created during development between releases labels Dec 24, 2022
@DevilXD DevilXD pinned this issue Dec 24, 2022
@DevilXD DevilXD changed the title v15.dev: Client ID <-> cookie auth token client ID mismatch v15: Client ID <-> cookie auth token client ID mismatch Dec 25, 2022
@matarife123

This comment was marked as off-topic.

@DevilXD DevilXD mentioned this issue Jul 7, 2023
10 tasks
@DevilXD DevilXD unpinned this issue Jul 7, 2023
DevilXD added a commit that referenced this issue Sep 15, 2024
if the Client ID within the cookie does not match the Client ID currently used by the application (#107)
@DevilXD
Copy link
Owner Author

DevilXD commented Sep 15, 2024

df05fb2 now automatically handles this case, by clearing the jar and deleting the cookie, then looping back for re-auth.

@DevilXD DevilXD closed this as completed Sep 15, 2024
@DevilXD DevilXD added Solved This issue has been resolved and removed Critical For critical issues that prevent the application from working labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev For interminent issues created during development between releases Solved This issue has been resolved
Projects
None yet
Development

No branches or pull requests

2 participants