tutorial authenticate node.js passport.js

node.js - tutorial - qué es req.isAuthenticated() passportJS



passport authenticate('' local (1)

En pasaporteJS Documention, creo que la función autenticada por pasaporte no está bien documentada.

Quiero preguntar qué es lo que pasaport.isAuthenticated () id?


Para cualquier solicitud, puede verificar si un usuario está autenticado o no utilizando este método.

app.get(''/some_path'',checkAuthentication,function(req,res){ //do something only if user is authenticated }); function checkAuthentication(req,res,next){ if(req.isAuthenticated()){ //req.isAuthenticated() will return true if user is logged in next(); } else{ res.redirect("/login"); } }