fix: users unable to authenticate with twitch auth #5279
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.
This fixes the Twitch auth strategy which currently displays "Oops, something went wrong...Failed to fetch user profile" when users attempt to authenticate.
Cause
On May 1 2021, Twitch began requiring a "Client-Id" header for all Helix API calls. The current Twitch passport strategy package (
passport-twitch-oauth
) has not been updated to account for this, thus its/users
call to the Twitch API always fails.Code in question: https://github.com/mattgaunt/passport-twitch/blob/master/lib/strategy.js#L75-L76
Proposed Fix
Given the
passport-twitch-oauth
package has not received any updates for 4 years since it's initial 1.0 release, I opted to move to a more maintained package instead of trying to submit a fix to the current one. After some searching, passport-twitch-strategy appeared to be the best option out there right now.The only code that needed to be updated to account for the strategy change was the
picture
property as this new strategy passes along Twitch response data as-is instead of mapping it.Testing
Setup a twitch auth in local dev environment and ensured I was able to successfully authenticate