DEV Community

Discussion on: Learn using JWT with Passport authentication

Collapse
 
picode246 profile image
Pi-code246 • Edited

I think there is an error in the following line in the passport.js file:

        return UserModel.findOneById(jwtPayload.id)
Enter fullscreen mode Exit fullscreen mode

I'm almost positive (I'm still learning though) there is no findOneById() function. This throws an "findOneById() is not a function" error. It worked for me when I switched it to findOne()

There's also something wrong with the quote marks in this line in theroutes/auth.js file:

const passport = require("passport”);
Enter fullscreen mode Exit fullscreen mode

The first quote mark is Unicode Character U+0022
The second one is Unicode Character “”” (U+201D)

Collapse
 
bigvl profile image
Vlasa Andrei

On the newer version the findOneById was deprecated, but when the article came out it was still in use.