I am using Passport.js for Twitch Auth. I am currently using this https://github.com/Nigh7Sh4de/passport-twitch-new to create the strategy.
This is the error I’ve been getting
InternalOAuthError: failed to fetch user profile at C:\projects\squadstream\node_modules\passport-twitch-new\oauth2.js:75:36 at passBackControl (C:\projects\squadstream\node_modules\oauth\lib\oauth2.js:132:9) at IncomingMessage.<anonymous> (C:\projects\squadstream\node_modules\oauth\lib\oauth2.js:157:7) at IncomingMessage.emit (events.js:322:22) at endReadableNT (_stream_readable.js:1187:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)
This is what my strategy code looks like
passport.use(
new twitchStrategy(
{
clientID: process.env.TWITCH_CLIENT_ID,
clientSecret: process.env.TWITCH_CLIENT_SECRET,
callbackURL: process.env.TWITCH_CALLBACKURL,
scope: "user_read",
},
function (accessToken, refreshToken, profile, done) {
// Suppose we are using mongo..
console.log(profile);
}
)
);
and my routing
router.get("/twitch", passport.authenticate(“twitch”, { forceVerify: true }));
router.get(
"/twitch/callback",
passport.authenticate("twitch", { failureRedirect: "/" }),
function (req, res) {
// Successful authentication, redirect home.
res.redirect("/");
}
);
As you can see I am following the example but still getting an error. Can anyone point me in the direction to where I may be making a mistake?
Thanks.