1

I am trying to make a very simple app with spring social, the app is not for public. What I am trying to achieve is to post to my wall or to the page that I administer.

Trying to ask facebook for access to manage_pages permission they denied because as they said "You do not need to request these permissions because your blog or CMS is integrated with an app that you admin. As an App admin, you can already access these permissions and post to your timeline or a page you admin. You can provide access to additional users by adding them as developers of your App."

Now in the code. I altered a bit spring social showcase example. And my case is as follows: 1) I login to facebook through my app 2) Trying to get the number of pages that I administer 3) Post to my wall.

For step two I am using this code:

if (facebook.pageOperations().getAccounts() != null) {
        System.out.println("SIZE OF ACCCOUNTS IS: " + facebook.pageOperations().getAccounts().size());
    }

The size of accounts is always 0. So this means that although I should be able to post to the pages that I am administrator I can not even see them. Am I correct?

For step three now:

facebook.feedOperations().updateStatus("I'm trying out Spring Social!");
    facebook.feedOperations().post(new PostData("me").message("I'm trying out Spring Social!")
        .link("http://www.springsource.org/spring-social", null, "Spring Social", "The Spring Social Project", "Spring Social is an extension to Spring to enable applications to connect with service providers."));
    System.out.println("FEED POSTED");

both of those attempts fail with the following exception:

org.springframework.social.InsufficientPermissionException: Insufficient permission for this operation.

Could someone help please?

giannisapi
  • 2,641
  • 3
  • 24
  • 31
  • Where and how are you asking for permissions? And do you actually get asked for those permissions when you log in to your app? – CBroe Jul 09 '15 at 14:15
  • no i am not being asked for permission when loggin in, when i submitted those permission such as manage pages for review they told me i dont need them as i am an admin. – giannisapi Jul 13 '15 at 18:41

1 Answers1

0

It seems like you have not asked/granted the permissions that you need during login. The first thing that you need to do is implement login and ensure sure that you include the correct scope i.e. permission (manage_pages) during login. Since your requirements also include publishing, include these permissions publish_pages and/or publish_actions depending on whether you want to publish as a page or yourself. e.g. if you are using the JS SDK, it would look something like this:

 FB.login(function(response) {
   // handle the response
 }, {scope: 'manage_pages, publish_pages, publish_actions'});

Once you do this, on logging in, you will be prompted if you want to grant these permissions. On granting, your access token will contain these permissions and you will be able to make a call to /me/accounts which will give you a list of pages that you admin and their respective access tokens. It will look something like this:

"data": [
    {
      "access_token": "CAACEdEose0cBAAy...",
      "category": "Food/Grocery",
      "name": "Page Name",
      "id": "1234567890",
      "perms": [
        "ADMINISTER",
        "EDIT_PROFILE",
        "BASIC_ADMIN"
      ]
    },
    ...
    ]

If you want to publish as yourself, then you can continue using the current user access token. Else if you want to publish as a page, grab the page access token from the response above and use that to make the POST request against the page id.

And if you are creating an app for yourself and not for the public, then you do not need to submit these permissions for review provided you are an admin or have some role in the app.

You might be able to find some more context here.

Community
  • 1
  • 1
bangdel
  • 2,523
  • 5
  • 28
  • 42
  • that makes sense since when i submitted manage pages for review they told me that i do not need those because the app is not for the public and i am an admin of the application. Your answer makes sense, I will give it a try and let you know, thanks for your answer – giannisapi Jul 13 '15 at 18:42