Grant publish_actions - facebook

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.

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

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.

items about "would like to post to Facebook for you"

I write a program that says "Program would like to post to Facebook for you"
what item should i submit for review?
is that "publish_actions"?
but Facebook just say "It looks like you haven't made any API requests to publish content with the publish_actions permission in the last 30 days. You, or any account from Roles, needs to test this app with this permission before you can submit it for review."
Then I add my account to testers and test the program,but nothing changed, why?
what should i do?
The message "Program would like to post to Facebook for you" appears because you're requesting the publish_actions permission during login. It sounds like your app doesn't actually make use of this permission though.
Keep in mind that if you're using a dialog or button to share content (for example the Share Dialog, Like Button, Send Button or Message Dialog), the publish_actions permission is not used as the actual sharing is done by the Facebook app. The publish_actions permission is only used if you're directly posting to Facebook from your app via the Graph API by calling /me/feed or a similar endpoint.
If you're only using dialogs or buttons to share, you don't need to request the publish_actions permission during login and your app doesn't need to be reviewed for this permission.

Posting on my Facebook page from my app: Facebook login doesn't want to grant permission

I have a Facebook page (I'm the admin) and a Facebook app (I'm the developer) and through this app I want to post on this page.
Via https://www.facebook.com/dialog/oauth I'm trying to grant to my app the manage_pages permission of my page. But an error pops up:
"Some of the permissions below have not been approved for use by Facebook. Submit for review now or learn more."
If I click on "ok" I obtain the access token (and then the fb_exchange_token) but, as the pop up says, something goes wrong: the app isn't able to post on the page ("The user hasn't authorized the application to perform this action").
Why is this?
As mentioned in the comments, that error message states the user hasn't authorized to post (perform this action). You need to grant publish_actions and you need to use the page token to post to call as well.

Facebook App - Prompt permission to post

I have created an app. It does not prompt users to Post on Wall permission, after the GO to App popup. I have given the following settings for my app in developer account.
User & Friend Permissions: email,user_activities,user_likes,publish_actions
Extended Permissions: publish_stream,read_stream,offline_access
When i click a "Preview Login Dialog" link, it shown the following rights in "GO to App" popup.
THIS APP WILL RECEIVE:
Your basic info
Your email address
Your activities
Your likes
But, when i access the app at the first time, it shown the following rights alone.
THIS APP WILL RECEIVE:
Your basic info
Due to this, i could not post on well. I have checked.
Similarly, i have checked user's app setting page.
User account has no option like the below.
* Post on your behalf
* Access posts in your news feeds
What is wrong? I spent more than 3 hours to find out.
Be sure that you have expected permissions set in the scope parameter of method invoking the login dialog:
FB.login(function(response) {
// handle the response
}, {scope: 'email,user_activities,user_likes,publish_actions,etc...'});
And just in case, to be sure that you will have needed permissions before doing something that needs them, try handling revoked premissions, as I pointed here.
BTW, be sure to request only permissions your app really needs. You can scare users with so many permissions. ;)