使用Facebook Graph API& HybridAuth [英] Get Friends Location using Facebook Graph API & HybridAuth

查看:152
本文介绍了使用Facebook Graph API& HybridAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题



我正在尝试从Facebok Graph API中获取 friends_location 。我正在使用问题,但我已经在我的请求中包含了 friends_about_me 权限。

解决方案

查看Graph API资源管理器:



https://developers.facebook.com/tools/explorer



点击获取访问令牌按钮并选择(在朋友数据权限选项卡下):




  • friends_hometown

  • friends_location



一旦您给出访问令牌的权限,请单击右侧列中的连接下的朋友链接。您的GET请求应该如下所示:



https://graph.facebook.com/123456789/friends



您现在应该有一个名单和ID的朋友列表。如果您点击该ID,您将看到该朋友的结果,包括家乡和地点。



希望有帮助。


Problem

I am trying to get friends_location from the Facebok Graph API. I am accessing the API using the HybridAuth framework. How do I return a friend's location/hometown etc?

My App Permissions

I have set the following permissions for my app:

friends_about_me,friends_location,friends_hometown,user_location,email,user_birthday,offline_access,user_hometown

This is the request for permission screen the user sees on Facebook:

What I Have Tried

I have tried the following methods to get the friend's details:

HybridAuth: $hybrid->getUserContacts();

and

Native API: $hybrid->api()->api('/me/friends');

Both return the following format without the friend's location:

{"identifier": "12345678","displayName": "Joe Smith",},

I have also seen this question but I have already included the friends_about_me permission in my request.

解决方案

Take a look at the Graph API explorer:

https://developers.facebook.com/tools/explorer

Click on the "Get access token" button and select (under the Friends Data Permissions tab):

  • friends_hometown
  • friends_location

Once you have given the permissions for the access token click the friends link under connections in the right hand column. Your GET request should now look something like this:

https://graph.facebook.com/123456789/friends

You should now have a list of your friends with their name and id. If you click on the id you will see the results for that friend which include the hometown and location.

Hope that helps.

这篇关于使用Facebook Graph API& HybridAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆