Skip to content

Fix TwitchLogin + Example #812

Open
xxxpabloxxx wants to merge 2 commits intoTkd-Alex:masterfrom
xxxpabloxxx:master
Open

Fix TwitchLogin + Example #812
xxxpabloxxx wants to merge 2 commits intoTkd-Alex:masterfrom
xxxpabloxxx:master

Conversation

@xxxpabloxxx
Copy link

Description

Fixed a crash caused by invalid persistent cookie parsing and resolved an issue where the user_id could not be retrieved from the Twitch API.

Specific changes:

  • Added try-except block in get_user_id to gracefully handle malformed persistent cookies.
  • Updated Authorization header to use OAuth prefix instead of Bearer to match Twitch GQL API requirements.
  • Added Client-Version header to __set_user_id requests.
  • Changed cookie parsing warning to debug level to reduce log noise.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

Ran the bot locally and verified that:

  1. The ValueError trace is no longer raised on startup.
  2. The bot attempts to fetch user_id via API if the cookie is invalid.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md)
  • My changes generate no new warnings
  • Any dependent changes have been updated in requirements.txt

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.

1 participant