1

In my application I ask user to login via facebook, then I send received token to server from where I want to post to users timeline.

I use sromku simple facebook wrapper. I request these permissions:

Permission[] permissions = new Permission[] {
    Permission.USER_PHOTOS,
    Permission.EMAIL, Permission.PUBLISH_ACTION,
    Permission.PUBLIC_PROFILE, Permission.READ_FRIENDLISTS,
    Permission.USER_ABOUT_ME
};

The problem is, that if I publish Feed object to user from android application, it is posted with no problems, but when I try to do the same from server I get:

(#200) The user hasn't authorized the application to perform this action'

If I request available permissions for my token I get:

installed [status] => granted
public_profile [status] => granted
email [status] => granted
read_friendlists [status] => granted
user_activities [status] => granted
user_photos [status] => granted
user_about_me [status] => granted

There is no publish_actions and also publish_stream (There's no option to ask this in simple facebook that I know of).

Maybe someone can help me identify where the problem lies?

[EDIT] After listing permissions retrieved from original facebook Session (with: simpleFacebook.getSession().getPermissions()) object I see:

Permission: public_profile
Permission: email
Permission: contact_email
Permission: read_friendlists
Permission: user_activities
Permission: user_photos
Permission: user_about_me

This is really strange, because it does not list my publish_actions permission, yet still successfully posts to my feed.

SMGhost
  • 3,867
  • 6
  • 38
  • 68

2 Answers2

0

According to https://github.com/sromku/android-simple-facebook/blob/master/Simple%20Facebook/src/com/sromku/simple/fb/Permission.java#L46 it should be possbile to request the PUBLISH_ACTION permission , as you already have in your code.

I guess you're not using an admin/tester/developer user of your app?! Then you have to pass the Facebook app review first before you can request the extended permissions, as outlined in https://developers.facebook.com/docs/apps/review/login#do-you-need-review

Tobi
  • 31,405
  • 8
  • 58
  • 90
0

I was using this method:

publish(feed, true, new OnPublishListener() {});

It opens webview dialog so I was actually posting on facebook, that's why I didn't needed permission. When I changed to:

publish(feed, new OnPublishListener() {});

I've got a dialog where I had to accept publish permission. After that I was able to post with my token on facebook from server.

The problem here was, that I thought that if I specify all permissions before creating SimpleFacebook obect and then call login method, I will get all permissions. But this is only true for read permissions. To get publish permissions you have to explicitly call requestNewPermissions method after login, to get required publish permissions.

SMGhost
  • 3,867
  • 6
  • 38
  • 68