-
-
Save jesse1981/5537100 to your computer and use it in GitHub Desktop.
Get Facebook feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FB = require('fb'); | |
FB.api('oauth/access_token', { | |
client_id: process.env.FACEBOOK_APP_ID, | |
client_secret: process.env.FACEBOOK_SECRET, | |
grant_type: 'client_credentials' | |
}, function(res) { | |
if (!res || res.error) { | |
console.log('error occurred when getting access token:', res && res.error); | |
return; | |
} | |
console.log('set application access token:', res.access_token); | |
FB.setAccessToken(res.access_token); | |
}); | |
function getFeed() { | |
FB.api('hoge/feed', function(res) { | |
if (!res || res.error) { | |
callback(res ? res.error : 'unknown error'); | |
return; | |
} | |
console.log(res); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment