Unable to set permissions for Javascript SDK loginWithFacebookSdk

There doesn’t seem to be any way to set requested Facebook permissions using the javascript sdk loginWithFacebookSdk function.
Using the easy Facebook login this code works and the email permission is requested:

var facebookFieldsMapping = {"first_name":"first_name", "last_name":"last_name", "email":"email"};
var permissions = ["email"];
Backendless.UserService.loginWithFacebook(facebookFieldsMapping, permissions, new Backendless.Async( callback, gotError ));

But using the Facebook SDK method with the same code:

var facebookFieldsMapping = {"first_name":"first_name", "last_name":"last_name", "email":"email"};
var permissions = ["email"];
Backendless.UserService.loginWithFacebookSdk(facebookFieldsMapping, permissions, new Backendless.Async( callback, gotError ));

Only the default permission is requested and I don’t get the users email. Does anyone know what the problem might be? I would just use the easy method as it is working, but the facebook login popup I get from that method is too small and I get the message:
“You are using a display type of ‘page’ in a small browser window or popup. For a better user experience, show this dialog with our JavaScript SDK without specifying an explicit display type. The SDK will choose the best display type for each environment. Alternatively, use display type ‘popup’ if you have special requirements precluding you from using the SDK. This message is only visible to developers of your application.”
If anyone could tell me how to work around this problem so the user doesn’t have to resize the small popup when logging in with facebook using the easy method then I would just do it this way instead. Any help would be greatly appreciated.


When logging in with Facebook SDK, you need to request the permissions the way Facebook prescribes it.

As for the display type (“page” or “popup”) I’ll let our JS developers answer this question.


Thanks for your reply. So to be clear, you’re saying that if I want anything other than default permissions then i’ll need to call FB.login with the required permissions myself and then go about sending that data to backendless, rather than use Backendless.UserService.loginWithFacebookSdk?

Yes, that is correct.

I’ve set that up now and have it all working. Just a quick followup question:

The password property in the users table is required in Backendless. When I register a user via Backendless.UserService.loginWithFacebook the property is blank for the newly created user, but when I do it all manually via FB.login and creating the backendless user myself with the facebook info, I am required to put something in the password field. My question is, what makes sense to put here in this case? Should I just put thier facebook userID?

That does not sound right. If you were to register a Facebook user with a password in Backendless, the user would not be able to subsequently login. What you should do is login the user to FB first, then use the following REST call to establish user’s presence in Backendless (scroll down to the “Login with Facebook SDK” section):


I’m fairly new to web development and still trying to get this all set up and working. If it were possible to still get an answer to my question about using the easy method with the facebook login popup being too small and how to correct this I would greatly appreciate it as it would be much simpler to do things that way for me.

I got the SDK version working :smiley: Once I learnt curl and fixed up some formatting I can now register a user that has logged in with facebook. It would still be interesting to know how to fix the small popup issue with the easy login, but you can close this issue if you want.

Thanks for your help Mark.

Hi Aaron,

the issue with small popup is already fixed and will be released very soon. I will let you know in this thread when it gets available.



Would you please consider sharing the working code with the community?