Jonah
Jonah

Reputation: 16202

Force New Permission Request For Already Logged In FB User

I have added a new permission request (publish_stream) to our facebook connect login button. I'm having a problem with existing users who have previously authorized our app without this permission. If they are logged out of facebook when they arrive at our site, everything works fine and when they click on "Facebook Connect" they get the popup asking them for the new permission.

However, if they are already logged in to facebook when they arrive at our site, they get auto-logged in and are not asked for this new publish_stream permission. How can I force the popup to come up and ask them for this new permission even in this already logged on to facebook scenario?

Thanks

Upvotes: 4

Views: 701

Answers (2)

SSH This
SSH This

Reputation: 1929

Sorry for adding an answer to an answered question, but I wanted to add some information that took a while to understand.

Basically, you just need to get the user to log in again, and they'll be prompted to accept the updated permissions (assuming that you have already updated them inside your App settings).

For example, when you get the login url:

$login_url = $facebook->getLoginUrl($params = array('scope' => "publish_stream,user_groups"));

You can add the permission to the scope. In my app, I realized that I needed to add "user_groups" to get a list of groups. So if groups array came back empty (after a query to the api) then I echoed this:

echo "The current user appears to have no groups, if this is incorrec try to <a href=".$login_url.">login again</a>";

Upvotes: 1

DMCS
DMCS

Reputation: 31870

Call the Graph API for me/permissions and ensure they're subscribed to the permission. If they're not, then direct them to the login popup asking for all permissions that you need.

Upvotes: 2

Related Questions