How to access Facebook Graph API in Parse Cloud Code?

99封情书 提交于 2019-12-05 11:58:27

I couldn't use any libraries, so I've ended up using plain HTTP REST requests. For example, I was trying to get a user's name, gender, and user ID, I used this code by manually constructing the URL (where I had token access token variable of the user:

Parse.Cloud.httpRequest({
  url: 'https://graph.facebook.com/v2.1/me?fields=id,gender,name&access_token=' + token,
  success: function(httpResponse) {
     var responseData = httpResponse.data;
     ...

where responseData is now a JSON object with the returned data. It's not the best thing to do, but it works great for simple tasks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!