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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -