The stripped-down code below seems to work properly. I get logged into Facebook, receive a valid access token, get presented with a list of friends, can choose one or many of them and I am then returned a list of those chosen in a table called event.data. As expected, inside that table are two entries; id and fullName. The fullName is correct and shows the actual names of the FB users I chose. However, the ids look more like app ids and nothing like Facebook user ids. The output of event.data looks as follows:
table: 0x77a69610 { [1] =\> table: 0x77a69610 { [id] =\> "AaKEVLpMmwsGXBjuNMNH8urOw5teuInnoUPtRVrBoBPaBI3Y5Lo2ZSiMVJ2JiaYRw1CbXpSvIA0LtxoOrhMQj9yyz63gM3yhemlNqV9ur628GQ" [fullName] =\> "Alan Smith" } [2] =\> table: 0x77a69610 { [id] =\> "AaIHoRxu5lmht13bL8ba56Z88mZ-CEKv7a9atLs7pJl1aXbfmh6KvVSOn\_X6xaEfh0W\_biVIstJpRVHTgmMA1KNtJH6ZM6t3KknFG\_1F\_FJ2eA" [fullName] =\> "Alyssa Johnson" } [3] =\> table: 0x77a69610 { [id] =\> "AaKNPjRTGcs2Ah7hi9zHOJ\_xdW\_8QdKbjauysIJQZXt-yLlilX0JrVR0TDayw8Z5iM5XAD89FtTusuruCxtG5nO2a7rITU7W0vx0E97vPDbFKQ" [fullName] =\> "Angela Jones" } }
The Facebook ids should look something like this: 10153442260092654
Any assistance is greatly appreciated!
Thanks,
Scott
local facebook = require( "plugin.facebook.v4" ) local util = require("Utility") function facebookListener( event ) print("facebookListener") print("event.type", event.type) print("event.phase", event.phase) if ( "session" == event.type ) then if ( "login" == event.phase ) then accessToken = event.token if accessToken == nil then local alert = native.showAlert( "Notification", "Facebook error. Please check your Facebook credentials.", { "OK" } ) else facebook.showDialog( "friends", facebookListener ) end end elseif ( "request" == event.type ) then print( "request" ) response = json.decode( event.response ) elseif ( "dialog" == event.type ) then print( "dialog" ) response = json.decode( event.response ) elseif ( "friends" == event.name ) then print("friends") util:print\_r(event.data) else print("none of the above", event.type) response = json.decode( event.response ) end end print("start facebook login") facebook.login( facebookListener, {"public\_profile","email","user\_friends"} )