Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Apps: Additional permissions

Tags:

I have a working Facebook app that most users will use just once. Leading into the Facebook workflow, users indicate if they want their wall to be written to or not. Based on that, I either ask for the publish_stream permission or not.

Later, a small percentage of users will come back and use the app again. Some of the people who previously did not want to write to the wall (and thusly I didn't ask for publish_stream) now want to write to their wall.

How do I request an additional permission after the user has already authorized the app?

Similarly, how can I query a user to list which permissions they have already granted?

like image 816
Scott C Avatar asked Feb 08 '11 17:02

Scott C


People also ask

How do I grant all my Facebook permissions?

Step 1: In Facebook, click the small arrow near your name in the upper-right-hand corner and choose Privacy Settings. Step 2: Scroll down to Apps and Web sites and click on Edit Settings off to the right. Step 3: If the app you want to adjust is in the recently used list, click on it to edit settings.

What are Facebook permissions?

Permissions with Facebook Login. When a person logs into your app via Facebook Login you can access a subset of that person's data stored on Facebook. Permissions are how you ask someone if you can access that data. A person's privacy settings combined with what you ask for will determine what you can access.

Why do Apps always ask for so many permissions?

Apps require access to different components and data on our Android devices to work as intended, and in most cases, we have to grant them permission to do so. In theory, Android app permissions are a great way to ensure our safety and protect our privacy.

Why is Facebook saying I have insufficient permissions?

Insufficient Permissions Error If you've ever noticed a post fail with this error message for your Facebook Page, it means that SocialBee does not have sufficient permissions in your Business Integrations.


1 Answers

It's as simple as adding the new permission to a new fb:login-button:

<fb:login-button scope="publish_stream">
  Let me write on your wall!
</fb:login-button>

So for example you have the above hidden in a DIV and if the user tick a checkbox you show the DIV and prompt the new permission!

A good live example of this is on the Facebook Test Console:

  1. Click login to "add" the application
  2. Then click on examples
  3. Under fb.api choose does-like

Now you can see that even after being *connected to the application (test console app), you can actually have another login button to prompt the user!

EDIT:
To check if the user has granted your application a permission, just use this FQL:

SELECT read_stream,offline_access FROM permissions WHERE uid=me()

This would return something like:

[
  {
    "read_stream": 1,
    "offline_access": 0
  }
]

To test it, just use the test console posted early.

EDIT 2:
To construct the link yourself without XFBML or Javascript, you just need to add the scope parameter with the additional perms (reference):

https://www.facebook.com/dialog/oauth?
     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=publish_stream

Or if your are using the PHP-SDK:

$loginUrl = $facebook->getLoginUrl(array(
    "scope" => "publish_stream"
));
like image 70
ifaour Avatar answered Oct 14 '22 01:10

ifaour