Search code examples
facebookfacebook-graph-apimeteormeteor-accounts

Meteor facebook API : user_friends permission missing


I'm using account-facebook and fbgraph packages with meteor, my service configuration looks like this :

{ _id: 'zDCcCKawiBFrgLQ8Q',
   service: 'facebook',
   appId: edited,
   secret: edited,
   requestPermissions: [ 'user_friends' ] }

I get an access token at login and can get the email and public profile fine, but my permissions only include those permissions and not user_friends :

{ data: 
  [ { permission: 'email', status: 'granted' },
    { permission: 'public_profile', status: 'granted' } ] }

I thought user_friends was a given permission. What am I missing?


Solution

  • SOLVED by rewriting the loginWithFacebook:

    Template.third_party.events({
      "click .btn-facebook": function(e, t){
        Meteor.loginWithFacebook({
          requestPermissions: ['email', 'user_friends']
          }, function (err) {
          if (err)
            Session.set('errorMessage', err.reason || 'Unknown error');
        });
      }
    });
    

    Where third party is the template that includes the facebook button.