title: How to access Facebook Graph API in Parse Cloud Code?
body: <p>I need to get friends of a user that logged in with Facebook at my Parse app, inside a cloud function. How can I achieve this? I've tried to install <code>facebook-node-sdk</code> (<a href="https://github.com/Thuzi/facebook-node-sdk/" rel="nofollow noreferrer">https://github.com/Thuzi/facebook-node-sdk/</a>), but even though I've copied all the dependencies into the same folder, it complains about being unable to load the package when I <code>require</code> it. I've also found this question: <a href="https://stackoverflow.com/questions/22985553/how-can-i-get-the-user-first-name-from-facebook-in-cloud-code">How can I get the user first name from facebook in cloud code?</a> but the answer there doesn't work (<code>FB</code> is not defined). I can do raw REST calls to Graph API with my access token using <code>Parse.Cloud.httpRequest</code> but managing endpoints, access token, parameters etc. quickly becomes messy. What is the preferred way of accessing Facebook Graph API from Parse Cloud Code?</p>