Cannot get facebook user feed using javascript - facebook

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)

Related

How to request pages_show_list permission with Facebook Graph API?

I tried 2 way, one in the Facebook Developer site find permission request with this name, I couldn't find it.
add as a 4th parameter to the Facebook Login Button, it did not help
<FacebookLogin
appId={fbAppId}
autoLoad={true}
fields="name,email,picture,pages_show_list"
onClick={this.componentClicked}
callback={this.responseFacebook}
/>
Do you have any other idea?
The Facebook API works like this,
Development Mode: For development mode you can try to access pages which were associated with the account in which app created. So, that pages associated with that user can be accessible. You can retrieve the pages using following link,
https://developers.facebook.com/docs/graph-api/reference/user/accounts/
Live mode: In case of live mode you need to create a video of snapshot using your development mode functionality and get "pages_show_list" permission approved. Then you can access the pages details associated with authenticated users.
For login button you can try like this,
fb:login-button size="large" scope="public_profile,email,pages_show_list,read_insights,manage_pages" onlogin="checkLoginState();"
which gives you token and use that token to get pages associated with user account.
If you are using the js SDK of Facebook then there is an option to ask permission through SDK functions.
FB.login(function(response) {
// handle the response
}, {scope: 'public_profile,email,..other persmissionlist'});
Note:-
Use this concept only when your app is in the testing phase and
wants to create a request for permission in App Review or there are
some permissions enabled but you want only a few.
Use this approach with Test users only.
Reference link:-
https://developers.facebook.com/docs/facebook-login/web#re-asking-declined-permissions

Get user profile link from Facebook's Graph API

I have an app-scoped user id (ASUID) for a Facebook user and I wish to obtain a link to that user's profile page.
A post on Facebook's Developer blog dated May 1, 2018 states that this link is accessible as of Graph API v3.0 through the link field on a user object. Access to this field requires the user_link permission be approved for the app and granted by the app user.
I have attempted to access this field with a user access token associated with my test app and I have verified the access token has the user_link permission granted via the Access Token Debugger. However, the link is not included in the response.
Request:
https://graph.facebook.com/v3.0/[ASUID]?fields=link&access_token=[ACCESS_TOKEN_W_USER_LINK_PERMISSION]
Response:
{ "id": "[ASUID]" }
Is there any indication as to why this is not working?
As documented, the user_link permission requires an App Review pass before it's available to live apps.
At time of writing this answer there is no way to get user profile page using Facebook API.

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.

How to get facebook friends using playfab?

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

Grant publish_actions

I want to share some url to facebook, here is the code
FB.ui(
{
method: 'share',
href: "http://SomeWebPage"
},
function (response) {
});
On documentation of the Share Dialog written that response data
Only available if the user is logged into your app using Facebook and
has granted publish_actions. If present, this is the ID of the
published Open Graph story.
Lets say that user not logged in to Facebook and click on my share button
what i am see is that
The user about to login my app "Pay oneerDev"
But were exactly publish_actions mentioned above are defined?
How user agrees this action?
Then when user shares i get "[]" as a response data all the time instead of some id, there is no way to know if user actually shared or cancelled or some error occurred.
For publish_actions, you would need to implement Login, and you would need to go through Login Review with that permission before it´s available for everyone. Just to know if something was shared or not will definitely not get that permission approved, because Share Gating is not allowed according to the platform policy:
4.5: Only incentivize a person to log into your app, enter a promotion on your app’s Page, or check-in at a place. Don’t incentivize other actions.
Btw, in order to make the Share Dialog work, the user just needs to login to Facebook - NOT your App. Make sure you understand the difference.