I need to get all the albums from facebook using nodejs and express.I am using passport to authenticate the user.
passport.use(new FacebookStrategy( {
clientID : FACEBOOK_APP_ID,
clientSecret : FACEBOOK_APP_SECRET,
callbackURL : FACEBOOK_CALL_BACK_URL,
profile : true
}, function(accessToken, refreshToken, profile, done) {
FB_ACCESS_TOKEN = accessToken;
process.nextTick(function() {
console.log("FB_ACCESS_TOKEN : " + FB_ACCESS_TOKEN);
return done(null, profile);
});
}));
In call i am requesting for scope user_status,user_photos and offline_access
app.get('/auth/facebook', passport.authenticate('facebook'), {
scope : [ 'user_status', 'user_photos','offline_access']
}, function(req, res) {
});
To get all albums I am using
app.get('/albums', function(req, res) {
FB.setAccessToken(FB_ACCESS_TOKEN);
console.log("FB_ACCESS_TOKEN @@ : " + FB.getAccessToken());
FB.api('/me/albums', function(resp) {
console.log("Albums " + JSON.stringify(resp));
});
});
But in console i am getting
Albums {"data":[]}
NOTE : I checked the fb javascript example fbrell.com/fb.api/photo-albums In that the scope specified are "user_photos,friends_photos,user_photo_video_tags,friends_photo_video_tags".I just want the photos and so i used user_photos
Any help??