[英]facebook users who r not my friends but using the app
The new Facebook graph api has divided friends into Friends
& Invitable_friends
. 新的Facebook graph api将朋友分为
Friends
和Invitable_friends
。
me/friends/
returns my friends who are using the app while me/invitable_friends/
returns only the list of my friends who are not using the app. me/friends/
返回我正在使用该应用程序的朋友,而me/invitable_friends/
仅返回我未使用该应用程序的朋友的列表。
But in my app,a user may interact with random users too who may not be on his friend list. 但是在我的应用中,用户也可能与随机用户互动,这些用户可能不在他的朋友列表中。
So how do i get user data for those who are using the app but are not on my friend list. 因此,我如何获取正在使用该应用程序但不在我的朋友列表中的用户的用户数据。
Thanks. 谢谢。
I went through the same issue and solved it like that: when a user starts your app by default you ask for permission to access his public profile information, which includes real ID, name and some other. 我经历了同样的问题,并通过以下方式解决了该问题:默认情况下,当用户启动您的应用时,您会请求访问其公开资料信息的权限,其中包括真实ID,姓名和其他一些信息。 You simply store the user data (id, name, etc.)in a database.
您只需将用户数据(ID,名称等)存储在数据库中。 This way you keep track of all the people using your app and they can interact with each other.
通过这种方式,您可以跟踪所有使用您的应用程序的人,他们可以彼此交互。
JavaScript Example: JavaScript示例:
window.fbAsyncInit = function () {
FB._https = true;
console.log('here');
FB.init({ appId: 'xxxxxxxxxxxxxxxx', cookie: true, xfbml: true, oauth: true, version : 'v2.0'});
Login();
};
function Login() {
FB.login(function(response) {
if (response.authResponse){
checkUser();
}
else{
console.log('User cancelled login or did not fully authorize.');
}
}
);
}
function checkUser() {
FB.api('/me', function(response) {
$.ajax({
type: "get",
url: "cgi-bin/checkUser.cgi",
cache: false,
data: {"user_name" : response.name, "u_id" : response.id, "link" : response.link},
success: function() //onSuccess,
{
console.log("user " + response.name + " checked!");
},
error: function()
{
console.log("Error with server connection on user checking");
}
});
});
}
I don't know in what language you are writing the app but I believe that in every language you should call the "login" function, which asks the user for permissions and basically gets access to info. 我不知道您使用哪种语言编写应用程序,但我相信您应该使用每种语言调用“登录”功能,该功能向用户询问权限并基本上可以访问信息。
To get details of users who are using the app but are not your friends,call the following 要获取正在使用该应用但不是您的朋友的用户的详细信息,请致电以下
graph.facebook.com/v2.0/
graph.facebook.com/v2.0/
?ids={comma-separated-ids}&access_token=app_access_token&fields=name,picture
?ids = {逗号分隔的ids}&access_token = app_access_token&fields =名称,图片
access_token is a must else graph-api returns following error- access_token是必须的graph-api,它在出现以下错误后返回:
The global ID xyz is not allowed. Please use the application specific ID instead.
This will work for all users who have authenticated the app no matter their authentication date,but for any non-app user graph-api returns above error message. 无论用户的身份验证日期如何,这将对所有已验证应用程序的用户均有效,但对于任何非应用程序用户graph-api返回上述错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.