Last active
October 13, 2015 02:28
-
-
Save joelongstreet/4125083 to your computer and use it in GitHub Desktop.
Request an access token from facebook and then use it to make a subsequent request.
This file contains 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
request = require 'request' | |
facebook = require 'fb' | |
get_fb_data = (req, res, next) -> | |
fb_req = 'https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECCRET&grant_type=client_credentials' | |
request.get fb_req, (err, res, body) -> | |
if err then console.log err | |
else | |
token = body.split('access_token=') | |
facebook.setAccessToken(token[1]) | |
facebook.api '7145472124/feed', (response) -> | |
console.log response.data | |
module.exports = get_fb_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment