Hi,
I’ve spent a fair amount of time trying to get my head around the facebook plugin and the facebook permissions, etc and I think Im pretty much there in terms of setting it up and getting permissions.
I have my app working in the following way (based on the sample facebook app) and it works as expected:
- Logs in to facebook first time. facebook loads with permission “your public profile” only (i.e. no email or friends)
- I gather the user id, profile pic and name but at this point cant get email due to permission (thats ok for now)
- later in my app I want to show who has the game installed so I call facebook.request(“me/friends”, “GET”).
- I now get redirected to facebook again to accept the permission for “your friends list”
- I accept and i get a list of friends that have the app installed
- so far so good and its a good user experience.
This is actually ok since I dont have to get the friends at the start - its only later when I need to show them. Facebook seems to like this method as it shows the user why you are asking for that permission.
My problem comes when I decided it would be good to grab the email address at the start. From what I have read on multiple posts, etc is that you need to do the following double login process:
- Log in to facebook once, accept the “your public profile” only
- log in / request again with “email” permission
- process the response which will now have user id, profile pic, name AND email
My problem here is that I’ll get taken to one facbook page, accept the “you public profile” permission and then it will switch to another facebook screen with the email permission - I believe this is how it works for everyone trying to do the same? If I have done something wrong at this point, please let me know!
I also read in this post (http://forums.coronalabs.com/topic/42990-facebook-request-friends-and-email/?p=250421) that this how facebook requires it to be done BUT… i have been going over the documentation on facebook and i can’t see where it states that.
infact it says that you should be able to request all “read only” permission at the first login:
https://developers.facebook.com/docs/facebook-login/ios/v2.0#permissions
“You can ask for any number of read permissions or for publish permissions during login. However, as a general rule, the more permissions an app requests, the less likely it is that people accept the permission request and continue with the login process.”
i.e. public profile, email and friends
It does however state that a second request / login SHOULD be done when asking for publish permissions:
“you should only ask for publish permissions once a person is ready to post something from your app and not during the initial login process. The login control makes this easy by separating read permissions and publish permissions”
Is there any small chance that there might be a bug in the facebook plugin and that you actually should be able to get public, email and friends (i.e. read permissions) with the first login requst e.g.
facebook.login( appId, callFacebook, {“email”, “user_friends”} )
If not, could someone from corona (maybe Rob) point me to where it says you have to login twice / do a second request for additional read only permissions?
It doesn’t seem right to have to display the facebook permission page twice one after another just to get the email address (and friends).
Thanks