Passport JS auth examples

I am trying to work with Passport JS, and on their site under Strategies I see 2 different Twitch ones, but they use the same example code; and then when I go to the github I see a third auth example using Passport and I am unsure which one to follow.

Example 1:
Example 2: <-- the one I am following right now.
Example 3:

Also, when I am testing my code I am getting Error 400 Invalid Client ID but I have it set correctly. And I am sure this also plays in, but under my developer console I am seeing:

reload.js:22 WebSocket connection to 'ws://localhost:3000/auth/login/ws' failed: Error during WebSocket handshake: Unexpected response code: 404 I didn’t see any reference to a WebSocket establishment in the example code.


May the 4th be with you!

Example 1: Looks very old, abandoned, and probably doesn’t work with the latest Helix changes.
Example 2: Confirmed to not work with the latest changes.
Example 3: Generally looks good, but seeing that it’s not an npm package, it would involve copy-pasting code, which is never a good idea in case it needs updates.

I just published a fork of passport-twitch-new which works with the new Helix changes:

You are a good man. Thank you for this. Shouldn’t Passport remove the old examples from their site? or is this Twitch’s responsibility?

Passport needs to update their site to link to the updated/working Twitch strat’s

Weird, I’m still getting this error:

Error InternalOAuthError: Failed to obtain access token (status: 400 data: {"status":400,"message":"Invalid authorization code"} )

Edit: I had missing passReqToCallback : true parameter :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.