Backendless Support
 
Waiting for user's response

Do we map the FB ID for Facebook Login

I know there were issues when we put in the Facebook ID when mapping the fields for Facebook Login and I saw a note on the fix for it. Is it recommended to map the facebook ID and put it into Backendless manually in the field mapping section of the facebook login function or should we not put it in?

We do need to have the facebook ID in backendless. That is very important. If we do not map it ourselves, will it automatically be put into Backendless?

  1. let fieldsMapping = [
  2. "id" : "facebookId",
  3. "name" : "name",
  4. "first_name": "firstName",
  5. "last_name" : "lastName",
  6. "gender": "gender",
  7. "email": "email"
  8. ]

Leave a Comment

Comments (5)

photo
1

Hi Nevin,

in any case, Facebook ID will automatically be added to the socialID column, which is important for our system and will be used when the user logs in as its identifier. There is no way to remove this column, because it is a system column.

Why is it so important this field to not present in the table?

Regards,

Stanislaw

photo
1

So do you recommend us to put it in field mapping section or not? It is very important that this field is present in the table. I am also not seeing a social ID column only an "id" column and a "socialAccount" column. Are both the "id" column and a "socialAccount" column system columns? Does Backendless put the id into the "id" column if there is not field mapping for Facebook ID in our code?

so should it look like this

  1. let fieldsMapping = [
  2. "id" : "facebookId",
  3. "name" : "name",
  4. "first_name": "firstName",
  5. "last_name" : "lastName",
  6. "gender": "gender",
  7. "email": "email"
  8. ]

or like this?

  1. let fieldsMapping = [
  2. "id" : "facebookId",
  3. "name" : "name",
  4. "first_name": "firstName",
  5. "last_name" : "lastName",
  6. "gender": "gender",
  7. "email": "email"
  8. ]

photo
1

By `socialId` I meant `id` column which is created automatically by system and contains social id (facebook id in your case). Backendless automatically put value into it, so you don't have to make it manually through fieldsMapping.

photo
photo
1

Also when I have this line of code using swift and backendless 4 with the latest version of the iOS SDK that was released yesterday I think. I get nil even if the user is logged in with facebook. I make an API call to get the same data and I get the correct data but using the iOS SDK, I get nil. I have tried to login and log out but that also does not help.

I also don't see "socialAccount" in the user schema.

  1. let socialLogin = backendless?.userService.currentUser.getProperty("socialAccount")

photo
1

Hello Nevin,

You can't get socialAccount directly from currentUser but you can retrieve it this way:

  1. let currentUser = backendless.userService.currentUser
  2. let socialAccount = (backendless.data.of(BackendlessUser.ofClass()).find(byId: currentUser?.objectId) as! BackendlessUser).getProperty("socialAccount") as! String

Regards, Olga