Search code examples
facebookfacebook-graph-apifacebook-javascript-sdkfacebook-apps

Facebook app check user permissions


Is it possible for my facebook app to check the privacy level of posts posted through it?

My use case is this: I want any posts by the user makes via apps to be visible to all of their friends. In case of a different privacy setting, I would like to alert the user, and ask them to fix the setting.

And to preempt any comments on usability, this is for a research study, and the user will be paid to the application for a short period of time. For the purposes of the research question, it's essential that all of their friends be able to see the posts from the application.


Solution

  • if you don't state the "privacy" when you post with you application on behalf of a user, your app's post is going to be public by default (if the app has been authorized and the user has pressed a button to post). If you want it to be visible to friends only, you have to state it in the privacy option. If you're referring to the post made through the share widget or a like button, then there's nothing much you can do, because those buttons work without user's authorization to the app. If the user has authorized your app to read their statuses (this is another separate action), you can get the last posts and check its privacy settings (it's in the JSON, if you call the graph at the URL /userid/feed. I hope this helps. EDIT: "privacy" is one of the possible settings of the JSON object you get if you call the same url used to post, with GET. Here's an example of what Facebook returns in the "data" oject:

     "privacy": {
                "description": "Friends",
                "value": "ALL_FRIENDS",
                "friends": "",
                "networks": "",
                "allow": "",
                "deny": ""
              }, 
    

    You have to modify that if you post. When "privacy" is empty ( as in "privacy": { "value": "" },it normally it means that the post or activity (story) is publicly visible.