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)
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.
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.
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.
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
Check this link for more details
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();
or You can go through this tutorial also.
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.
More Info