javascript - How to get instagram id once user has authenticated (instagram-node) -


i'm trying instagram id of user once have authenticated on website. have no problem authenticating since can access_token when log-in own account , can use following code assuming know instaid of user

exports.renderuser = function(req, res){  console.log("starting rendering");   var userid = "280430135";   api.user(userid, function(err, result, remaining, limit){   if(err){    console.log("current user " + err);   }    app.set('imgsource', result.profile_picture);   app.use('/', routes);   res.redirect('/');  }); }; 

am supposed instaid of user authentication code?

exports.handleauth = function(req, res) {   api.authorize_user(req.query.code, redirect_uri, function(err, result) {     if (err) {      console.log(err.body);      res.send("didn't work");     } else {      console.log('yay! access token ' + result.access_token);      res.redirect('/');     }   }); }; 

any appreciated. i'm using instagram-node since i'm using express app.

thanks!

turns out friend able answer questions faster anticipated.

exports.handleauth 

returns json response user information in format:

{  "access_token": "fb2e77d.47a0479900504cb3ab4a1f626d174d2d",   "user": {     "id": "1574083",     "username": "snoopdogg",     "full_name": "snoop dogg",     "profile_picture": "..."   } } 

source: https://instagram.com/developer/authentication/

therefore instaid , other user information can accessed calling

result.user.id result.user.full_name 

etc...


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -