Facebook Graph API - How to Request Additional Permissions

I am using Javascript SDK to register users on my site. This works and I can ask for permissions when I log in.

However, as recommended by Facebook, I would like to request only the most basic permissions on login and then request additional permissions as needed, since not all users will require, for example, publish permissions.

My question is how can I request additional permissions? The only way to request permissions that I can see in the docs is to do it at login. This post suggests calling again FB.login()

:

FB.login(function(response) {
    // ...do some stuff
}, {
  scope: ['publish_actions']
});

      

... but it makes mistake FB.login() called when user is already connected

. Most of the other posts on this topic just say to ask for all permissions on login, but this goes against FB's own advice.

Plan your application around asking for the minimum read permissions on initial logon, and then any posting permissions when the person actually needs them.

( From FB docs )

Aside from the error, the call FB.login()

does work correctly, but if it clearly throws an error, then of course this is not the correct way. Did I miss something?

+3


source to share


1 answer


You are not using it correctly:

FB.login(function(response) {
    // handle the response
}, {
    scope: 'publish_actions,some_other_permission',
    auth_type: 'rerequest'
});

      



It's not an array, it's just a string. And you should try with the auth_type parameter. Source: https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3#re-asking-declined-permissions

+11


source







All Articles