0

I am using Firebase simple login with Facebook, and have encountered a little problem last night. After logging in with permissions as an empty array (default) I get this

thirdPartyUserData = {
    email = <String>
    "first_name" = <String>
    gender = <String>
    id = <String>
    "last_name" = <String>
    link = <String>
    name = <String>
}

The difference is that now adays I do not see the 'picture' field, which was a dictionary with 'data' (and within 'data', 'url')... This change happened last night, is anyone else having the same problem with their authentication?

The permissions I have been logging on with are just [], (providing no permissions just uses the default)

modusCell
  • 13,151
  • 9
  • 53
  • 80
Ethan
  • 1,567
  • 11
  • 16
  • Are you still observing this? I just attempted to reproduce this issue, but I am getting the user's profile photo in thirdPartyUserData.picture.data.url – mimming Aug 18 '14 at 17:19
  • This is still occuring. However, when I tried to do the same thing using Firebase's js sdk, I have no problem. i have solved my problem by reconstructing the facebook profile image url from the facebook user's id. – Ethan Aug 18 '14 at 17:45
  • 1
    Ah got it iOS. I tried to repro with JS. It looks like Facebook treats them a bit differently. Does this other answer help? http://stackoverflow.com/a/20623845/839465 – mimming Aug 18 '14 at 18:33
  • Thanks Jenny Tong! I think what I'll just do is rely on the knowledge of `@"https://graph.facebook.com/%@/picture?type=small` points to their icon (or if they do not have an icon it has a default no-icon image. (Although, one day before this post, I was able to see 'picture' field in thirdPartyUserData, but no longer, yet firebase js auth still shows this field. Weird.) – Ethan Aug 18 '14 at 18:43
  • Got it. I'll investigate and update this question once I learn more :) – mimming Aug 18 '14 at 18:45
  • Thanks! You guys are Firebase are awesome! – Ethan Aug 18 '14 at 18:46

2 Answers2

2

Thanks for your time,

I haven't exactly solved the issue but incase anybody else is having the same problem (on iOS) as I am, you should check out the approach suggested by Jenny Tong; incase of the absence of profile icon, you can reconstruct the url;

http://graph.facebook.com/%@/picture?type=small http://graph.facebook.com/%@/picture?type=normal http://graph.facebook.com/%@/picture?type=large

where %@ is facebookID of the user. So in my case, I do the normal ...

authClient.loginToFacebookAppWithId(kFacebookAppId, permissions: [], audience: ACFacebookAudienceOnlyMe, withCompletionBlock: {(error:NSError!, user:FAUser!) in ...})

and if I do not find picture in thirdPartyUserData, i fall back on the above reconstruction. It works even if the user has not facebook profile image (you get default silhouette).

Ethan
  • 1,567
  • 11
  • 16
0

The contents of the third party data are the purview of Facebook and part of their API; it can change at any time they choose. The specific options you can enable and what you receive back are covered in this Facebook page under "reference". You may want to experiment with those. I do see "user_photos" under the extended permissions.

Regarding your "permissions array": To control what appears in the contents of thirdPartyUserData, you set those parameters as part of a comma delimited scope variable in simple login (a string not an array). Read the Facebook guide for a little info on how to do this.

Kato
  • 40,352
  • 6
  • 119
  • 149
  • Thanks for your time, but I have found that this is a problem possibly only on the Firebase iOS sdk; I tried from the web component and did not have any troubles. Also, user_photos is a little too much permission, I only want their profile icon & Firebase requires that you pass an array of permissions. – Ethan Aug 18 '14 at 17:43