plugins.twitch: refactor Twitch._access_token() #6403
Merged
+154
−77
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.
A couple of code refactor commits.
The initial motivation for these changes was adding authentication debug log messages. But then I decided against adding this, as it's unnecessary. If the
Authorization
Twitch API HTTP header has an invalid value, acquiring an access token will fail with an error message that perfectly describes the error. No auth and valid auth data pass silently. We don't need to log this and the user's name. Doing this only bloats up the GQL access token request by also queryingVerifyEmail_CurrentUser
(the most sensible query I could find on their website) and doing additional error handling.I'm going to leave this open for a bit and have another look later some time, to ensure there's no mistake which I didn't spot yet...