Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to tell if user granted your permissions or not with FB.login

I saw a similar question, and it mentions about the change in December 2011, and that part was right

http://facebook.stackoverflow.com/questions/8753085/in-facebook-login-how-do-you-see-the-permissions-that-the-user-granted

but the rest of the answer is wrong

I did notice this is part of the url though

https://s-static.ak.fbcdn.net/connect/xd_proxy.php?version=3&error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.#cb= ...

like image 361
alexl Avatar asked Feb 06 '12 06:02

alexl


People also ask

How do I see 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 permissions on Facebook?

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.

How do I Authorise my Facebook login?

You may need to enable Login from Devices in your app. Load your app's dashboard and set Product > Facebook login > Settings > Login from Devices to 'Yes'.

How do I manage permissions on Facebook?

From your Page, click Manage, then click Page Access. Click next to the person that you want to edit access, then click Edit Access. Click or to select the features you want this person to manage, then click Update Access. Type your Facebook password, then tap Confirm.


1 Answers

You will not know which permissions the user granted to your application in FB.login callback. You should query permissions connection for user object:

FB.api('/me/permissions', function(response){
  if (response && response.data && response.data.length){
    var permissions = response.data.shift();
    if (permissions.email) {
      alert('User have granted `email` permission');
    }
  }
});

Update:. While it's not stated by Facebook that callback for FB.login will not include perms or scope property which was used before switch to OAuth2 this is the case! There is nothing said in current documentation about permissions passed to callback for FB.login, FB.getLoginStatus or FB.getAuthResponse.

There is also bug report about this behavior which is marked as Won't Fix

like image 187
Juicy Scripter Avatar answered Oct 22 '22 20:10

Juicy Scripter