Hi,
I am trying to get the current users email address from facebook but I can’t seem to get it to work… I was able to get the profile pic, first name, last name, etc with no problems (using facebook.request(“me”, “GET”)) but email is being a pain…
I did some searching in these forums and found a comment by rob miracle in a post from jan 14 suggesting the code below is the way to do it (based off the facebook sample app). The comments after in the same post seemed to suggest that it worked for some users.
However, when I run the code I get this error:
FACEBOOK CALL FAILED The operation couldnt be completed. (com.facebook.sdk error 5)
I’m wondering if something has changed since rob’s post so I was hoping that somebody could maybe try this and see if it works for them (i.e. ive set something up wrong in the dev portal).
Or, is there another way I should be doing this?
Many Thanks
local function facebookListener(event) if (event.type == "session") then if (event.phase == "login") then sessionToken = event.token local params = { fields = "name,username,first\_name,last\_name,picture,installed,email" } facebook.request( "me", "GET", params ) end elseif (event.type == "request") then local response = event.response native.showAlert("My Response", response) end end facebook.login( fbAppID, facebookListener, {"publish\_actions, email"})
In facebook dev potal I have the following and im using my own facebook login that created the app
email
Provides access to the person’s primary email address. This permission is approved by default.
public_profile
Provides access to a person’s basic information, including first name, last name, profile picture, gender and age range. This permission is approved by default.
user_friends
Provides access to a person’s list of friends that also use your app. This permission is approved by default.