Meteor production app fail to use Facebook's user_friends permission

I have a mobile meteor app that uses the Facebook API and manage users authentication and sign-ups with the accounts-facebook package.

As long as I tested the app on meteor.com server and on local builds, the following code I provided successfully made the app use the Facebook’s user_friends permission:

(That’s under client/accounts.js)

Accounts.ui.config({ requestPermissions: { facebook: ['user_friends'] } });

However, since I deployed to production with mup, it seems like the user_friends permission doesn’t take effect on Facebook itself anymore. Going through my MongoDB I can see that in the db.meteor_accounts_loginServiceConfiguration collection the document for Facebook is:

{ _id: "gCMyTCnTXq3RTPMWm", service: "facebook", appId: "*********", // censored loginStyle: "redirect", secret: "***************************", // censored requestPermissions: [ "user_friends" ] }

So the Meteor app knows that it should ask new users for this permission. Looking at my Facebook account application privacy settings I can see that in contrast with the non-production version I had, there is no “user friends” permission anymore for my app:

Since it’s a mobile app, I tried editting the accounts-config.js to contain the permission as well:

ServiceConfiguration.configurations.upsert( { service: "facebook" }, { $set: { appId: "***********", // censored loginStyle: "redirect", secret: "********************************", // censored requestPermissions: ['user_friends'] } } );

Because I have customized login button I also do this while clicking it:

Meteor.loginWithFacebook(['user_friends']);

But had no success retrieving the permissions. Each time I did these changes I removed the users and the app from my Facebook account and tried again from a new Facebook login to avoid the fact that you can’t override Facebook’s permissions for exist user.

Appearently I used the Meteor.loginWith method wrong. It should get an options object that includes the requestPermissions string array like this, and the problem is solved:

    Meteor.loginWithFacebook({requestPermissions: ['user_friends']}, function(err){
        if (err){
            throw new Meteor.Error("facebook failure");
        }
    });