Documentation for “ensureAuthentication” “isAuthenticated” passport's functions?

前端 未结 2 2070
-上瘾入骨i
-上瘾入骨i 2020-12-07 12:41

I\'ve been looking for a while, and can\'t see to find a definitive documentation source. When I search for these, the first Google results are to StackOverflow.

Are

2条回答
  •  不思量自难忘°
    2020-12-07 13:21

    the reason it return false is mostly because its declared below the route definition. i am doing it in other file so i use it like this

    //auth check
    function auth(req,res,next){
        if(req.isAuthenticated()){
            next();
        } 
        else{
            res.redirect("/fail");}
    }
    
    //routes
    require("./routes/myroute")(app,auth);
    

提交回复
热议问题