node.js - How to check if user is already logged into instagram -
i using node.js, express, , mongodb instagram app. have found many times know whether or not user logged instagram (be through app via instagram-node authentication or through instagram's actual website).
is there easy way this?
i ended using passport solve problem. passport conveniently takes care of handling instagram authorization , include example app see how works. https://github.com/jaredhanson/passport-instagram/blob/master/examples/login/app.js
function ensureauthenticated(req, res, next) { if (req.isauthenticated()) { return next(); } res.redirect('/login') }
is useful since can placed @ top of routing file , routes underneath first check see if user authenticated.
Comments
Post a Comment