Facebook ID instead email

Hi guys,

sometimes, when an user logs in, my app saves the Facebook ID instead of email (login works every time).
I think that this error is strange because it happens only in a few cases.

This is the code that I’m using to login an user with Facebook:

FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];

@try {

    NSDictionary *fieldsMapping = [NSDictionary dictionaryWithObjectsAndKeys:




    [backendless.userService setStayLoggedIn:YES];

    [backendless.userService loginWithFacebookSDK:token fieldsMapping:fieldsMapping response:^(BackendlessUser *logged) {

        // User logged in with facebook...

    } error:^(Fault *fault) {

        //NSLog(@"FAULT = %@ <%@>", fault.message, fault.detail);




@catch (Fault *fault) {

    //NSLog(@"openURL: %@", fault);


Could it be that some users do not have an email address and in that case their facebook id is used?

Oh no! I’m sorry Mark but I was completely missing this reply from you!
I have resumed this post because I’m still getting this error.
I have one more info about this: I deleted an user who has the Facebook ID instead of his email then I told him to log in again.
Surprise! The user has Facebook ID instead of email!

I have a lot of user with this problem and I can’t have their emails for my newsletter, for example. (but for most of my users the above method has worked well and I got their emails fortunately).

I can’t test on this problem because I can’t create a fake user setting my Facebook ID in the email field.

Do you have an idea about this?

You should set readPermission property of FBSDKLoginButton:

let loginButton = FBSDKLoginButton()
loginButton.center = self.view.center
loginButton.readPermissions = ["public_profile", "email", "user_friends"]

Hi Slava, thank you for your help but my FBSDKLoginButton has already readPermission set in that way…

Is it possible to create (and reproduce) an user with my FacebookID as email on my test Backendless app so I can test with that user and try to find a solution?
Maybe I could tell to the user that there was a problem with the Facebook login and he should create a new user with email and password?
I don’t know what is the best way to solve this but I can’t test because I can’t create an user with Facebook ID as email and the biggest problem is that I have a some users who have FacebookId ad email.

Maybe you could create (behind the scene) that kind of user with my Facebook ID if I’ll give you that?

Please, update the latest Backendless SDK (pod 3.0.37 release).

In this version we’ve added a new method with permissions for login with Facebook SDK.

Now you can set your permissions instead of Facebook user account permissions, for example:

 NSDictionary *fieldsMapping = @{@"name" : @"name", @"email": @"email"};
 NSArray *permissions: @[@"user_friends", @"email", @"public_profile", @"contact_email"];
 [backendless.userService loginWithFacebookSDK:token
 permissions: permissions
 response:^(BackendlessUser *user) {
 NSLog(@"%@", user.email);
 error:^(Fault *fault) {
 NSLog(@"%@", fault);


I have already the latest SDK installed but I was missing this method. Thank you.
I will update my app very soon and I will try if all works well.

Just a question: If I perform a forced logout for a logged user, this new method will replace the old email field (the one with FacebookID) with the email of the user?

Thank you

Answer to question: no, you should manually remove these users from app dashboard. They will registered again during next login.

Ok, thank you so much Slava!

Hi guys, I’m still getting this error.
I have updated to the last SDK, changed the old method with the new one ([backendless.userService loginWithFacebookSDK:token permissions:permissions fieldsMapping:fieldsMapping response: error:) but I’m still getting IDs instead of emails!


Going back to my original question, is it possible that an email address simply does not exist in a Facebook profile?


I don’t know this. I think that each person that has a FB account has his own email address. How can be possible that a profile has no email?! Maybe I didn’t understand your question.

It is possible to have a facebook profile without an email address. For example, here are instructions for removing email from profile:


Ok but I think that you can remove an email when you have almost two addresses linked to your profile.
But if you remove the only email address linked to your profile, how can you have a valid profile? Because to access you need an email, to receive newsletters you need an email, if there is something wrong with your profile Facebook sends you an email and so on…

Perhaps you’re right. We would need to be able to reproduce the error. If you have a facebook profile which returns Facebook ID instead of email, please let us know. You can email the info to us at support@backendless.com.

What kind of info do you need to reproduce the error? My profile returns the email so I can’t use mine to try to find a solution. I have some users in my dashboard that have the Facebook ID instead the email…could we work with them?

We need to have whatever the minimum amount of information is to reproduce the error. Please provide that information by sending an email to support@backendless.com and include a link to this topic.


We got your email. The kind of information we need is essentially a Facebook account which demonstrates the problem. Without having access to such account, it would be extremely difficult to diagnose it and make any changes in the product.


It is possible to register on Facebook using phone number instead of email. Maybe this is the case?