How to get facebook friends using playfab? - facebook

i have been trying to access the facebook friendlists of the facebook test users through playfab. am using this code
public void FriendLists(){
GetFriendsListRequest request = new GetFriendsListRequest ();
request.IncludeFacebookFriends = true;
PlayFabClientAPI.GetFriendsList (request, GetFriends, FriendListError);
}
void GetFriends(GetFriendsListResult result){
friends = result.Friends;
Debug.Log("Friends");
for(int i=0;i<friends.Count;i++){
Debug.Log(friends[i].Username);
}
}
I have saved the Facebook app id and secret in playfab/setting/secret keys
All my test users are friends with each other
I have also logged in from the individual accounts to play fab.
but the friendlist still returns a null.
where am i going wrong?

Make sure your test users have granted the permission user_friends to your app.
You can check the permission for each test user using their access token at https://developers.facebook.com/tools/debug/accesstoken/.

We have a thread in our ticket system, but so others have the info:
Yes, setting IncludeFacebookFriends to true will cause the API to include Facebook friends who have also played the same game (Title ID), if those friends have also linked their Facebook account to their PlayFab account, and the token permissions allow for friend info.
The most common issue we see is a mistake when entering the Facebook App ID and Secret. Can you re-check those, to ensure they match exactly?
Next, check that the players in question have all linked their Facebook accounts. If both of those check out (given that you've already confirmed the token permissions), could you send us the PlayFab sign-in credentials for a user in this state (you can email devrel#playfab.com)?

The PlayFab Friend Manager Module is specifically designed to manage friend features. There are 4 method by which we can get facebook friends using playfab.
1.Add Friend by Email
2. Add Friend by PlayFabID
3. Add Friend by DisplayName
4.Add Friend by Username

Related

Cannot get facebook user feed using javascript

I need to get the user facebook feed and I have two account. Account A can get the feed detail. However account B cannot. Why this happened? It is related to the user facebook setting?I use the following FB api
var url = '/me/feed?fields=place,created_time';
FB.api(url, function (response) {
console.log(response);
});
Make sure that:
Your app is live and the relevant permissions are approved by facebook
or if your app is not live yet, all users are listed as admin/developer/tester under the App Roles AND have the proper permissions (e.g. user_posts)

Not able to post to Facebook using custom-ui project of socialauth-android project

I am not able to post Facebook using the custom-ui project of socialauth-android.
Here is the error log.
10-31 13:18:05.124: D/SocialAuthError(21880): org.brickred.socialauth.exception.SocialAuthException: org.brickred.socialauth.exception.SocialAuthException: Status not updated. Return Status code :403
10-31 13:18:05.124: W/System.err(21880): org.brickred.socialauth.android.SocialAuthError: Message Not Posted
10-31 13:18:05.124: W/System.err(21880): at org.brickred.socialauth.android.SocialAuthAdapter$6.run(SocialAuthAdapter.java:868)
10-31 13:18:05.124: W/System.err(21880): at java.lang.Thread.run(Thread.java:818)
I am not able to find the issue. I am using the same API keys got from the Github source.
You are getting 403 Authentication Error that clearly means that your app is presently not authorized to publish on Facebook profile of the user.
There is some problem the way you are trying to use Facebook APIs. I would suggest you to the latest Facebook SDK for Android as some of the older methods may be deprecated. Let me tell you the approach for doing this right way. (I recently implemented latest Facebook SDK)
You need a permission
There are some specific permissions that you require to do some specific operations with Facebook SDK. For example, You need publish_actions permission if you want your app to post status on user's profile.
Check Out It says,
For example, the publish_actions permission lets you post to a person's Facebook Timeline.
How to get Permissions
You need to show the user a login button which will ask him to do login with his facebook account and notifying the user what your app may do with his Facebook profile. It will show the permissions. In your case you need to add a login button with publish_actions permission. Once the user accepts it, your app becomes authorized to post status.
Complete Tutorial is here for doing the login process of Facebook with permissions.
You will need to do the following,
LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
authButton.setFragment(this);
authButton.setReadPermissions(Arrays.asList("user_likes", "user_status", "publish_actions"));
return view;
So you can see we are asking the user to give you the publish_actions permission. It is not mandatory to include user_likes or user_status permissions. You can remove them if you don't need them.
Next what after login
After the user logs in, you get an authentication token in your session with Facebook. So now you can use that to publish on user's profile.
How to post
Now there are many ways to publish posts or status on Facebook. The first one I would like to discuss is using the Graph API
Here is somewhat code, you can use to publish to facebook.
Session session = Session.getActiveSession();
new Request(
session,
"/me/feed",
null,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
}
}
).executeAsync();
NOTE
You do also need to create developer account with facebook and add your app to its dashboard, generate an app_id and mention the same in your AndroidManifest.xml file.

Facebook user_friends permission

On my app, i have a feature that uses the user's facebook "user_friends" permission.
It used to work before they upgraded to API V.2.0, but now it does not:
When I created the app on FB and used test users (in development mode) my feature that includes this permission worked.
But, when i turned on the app (to be live) - it does not work.
So - it works on Test users but not on Live users.
How is that possible?
This is because /me/friends will only return those friends which also have used (via Facebook Login) the app making the request.
See
https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends/#readperms
This will only return any friends who have used (via Facebook Login) the app making the request.
If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person.

FB Connect API - cannot get friends email id

I'm developing an web application in Java and using facebook account for login to my applications. After sucessfull login i need to get the logged in facebook account user friend's details including email id's. I can get the logged in user's friend's profile details but not the email ids of them. It always shows null. How do i get the email ids of my facebook friends.
Any help is very much appreciated.
Currently, this is not supported by Facebook. You cannot get user's friends' email, regardless of what permissions the user gives your app. Refer to the this for details.

Get Facebook User Id of my website visitors w/o auth

Is there any way to get the Facebook User Id of visitors in my website by using the FB API, but without need to ask them to authenticate my Facebook app?
All I need is some facebook-related-identifier, it does not even have to be the User Id, but any kind of identifier that can relate the user to a facebook profile.
Ideas?
If the user does not explicitly authorize you to get some private data from his Facebook account (included his Facebook ID), you can not get them.
I cannot think of a way to get the Facebook ID without the authorization of the user.
Hope that helps.