Support Topics Documentation Slack YouTube Blog

Facebook picture json


(Simone Valenti) #1

Hi!
I’m using “loginWithFacebookSdk” (Android) method to login, passing this facebookFieldsMappings:

Map<String, String> facebookFieldsMappings = new HashMap<>();
facebookFieldsMappings.put("first_name", "firstname");
facebookFieldsMappings.put("last_name", "lastname");
facebookFieldsMappings.put("email", "email");
facebookFieldsMappings.put("picture", "picture");

When I read that field inside handleResponse method, the field “picture” is a string like this:

{data={is_silhouette=false, url=https://picutre_uri}}

that I cannot transform in a JSON Object (to retrieve url field) because is malformed, should be like this:

{"data":{"is_silhouette":false, "url":"https://picutre_uri"}}

There is a way to get the “url” fields?
Thank you


(Mark Piller) #2

Hi Simone,

We looked into it and it is indeed a bug. I am assigning it to a developer.

Regards,
Mark


(Simone Valenti) #3

Thank you!


(Kate Maksimenko) #4

Hi Simone!

We updated production server with this bug fix. Could you try this use case again?
Regards,
Kate.


(Simone Valenti) #5

Thank you Kate! This works like a charm!


(Marcio Prudencio) #6

Hi There, with Rest login I’m receiving the full data in the picture field as shown below. Shouldn’t be saved just the URL?

{“data”:{“height”:50,“is_silhouette”:false,“url”:“https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=2392773524071836&height=50&width=50&ext=1548467660&hash=AeRoOXlSddLDN1oh","width”:50}}


(Sergey Chupov) #7

Hello Marcio,
I guess this is just what Facebook sends us in response. If your could prepare a minimal sample for us to reproduce the behavior, we could investigate further.


(Marcio Prudencio) #8

Hi Sergey, I’m login in on (/users/social/facebook/sdk/login) and requesting the picture in my fieldsMapping. Backendless saves automatically the response picture but is saving the whole thing instead just the URL. Now when I request a URL picture from the database I have to treat this field because is not just a URL. Regards

accessToken: this.state.accessToken,
fieldsMapping: {
“name”: “name”,
“email”: “email”,
“picture”: “picture”
}


(Sergey Chupov) #9

I see now. So as I said, we just store the value Facebook sends us, and it looks like it sends us more than just a URL. But you can create an afterLogin event handler which would process the value returned from Facebook and change update the column to pure URL from that value.