Facebook integration

Hi

I’m trying to enable the player to publish a message on his Facebook wall. I have correctly set up build.settings file and generated key hash number. 

my code is:

 ------------------ --FACEBOOK ------------------ local function listener( event ) if ( "session" == event.type ) then if ( "login" == event.phase ) then --facebook.request( "me/friends" ) facebook.showDialog( "apprequests", { message = "This is a test!" }) -- Fetch access token for use in Facebook's API local access\_token = event.token print( access\_token ) end elseif ( "dialog" == event.type ) then -- event.response is a JSON object from the FB server local response = event.response -- if request succeeds, create a scrolling list of friend names if ( not event.isError ) then response = json.decode( event.response ) local data = response.data for i=1,#data do local name = data[i].name print( name ) end end elseif ( "dialog" == event.type ) then print( "dialog", event.response ) end end -- NOTE: You must provide a valid application id provided from Facebook local appId = "xxxxxxxxxxxx" if ( appId ) then facebook.login( appId, listener, {"publish\_stream"} ) else local function onComplete( event ) system.openURL( "http://developers.facebook.com/setup" ) end native.showAlert( "Error", "To develop for Facebook Connect, you need to get an application id from Facebook's website.", { "Learn More" }, onComplete ) end

but as I try it on my pohne I get:

API Error Code: 110

API Error Description: Invalid user id

Error Message: Missing user cookie (to validate session user)

Has anyone expirienced the same issue?

Thanks

Tomaz

Hi Tomaz,

Did you put that “xxxxxxxxxx” bit in the code so people here can’t see the appId? Or is that your actual running code?

Brent

I have just hidden the appId. Otherwise I have set it up correctly.

Tomaz

Can you build the Facebook sample app correctly and run it?

Next, it sounds like you are doing this on Android.  Facebook changed their login process to a two step permission request since the last public build (1137) which your account is listed as a Starter, so I’m assuming that’s the version you are running.  This login process is very difficult to handle in our Corona environment.  We have since fixed it and hidden that multi-phase login issue in a daily build that you don’t have access to.   But as mentioned in another forum thread this morning, the next public build is undergoing testing now should have a new public release out soon.  I can’t give an exact date because I don’t know how long testing will take nor do I know if they find a problem and have to fix it, how long that will add.

In the sample app I get no response. 

I have entered these two values

local appId = 286955538112894 -- Add your App ID here (also go into build.settings and replace XXXXXXXXX with your appId under CFBundleURLSchemes) local apiKey = 63b29592d2d84c3eb95ddc01c934ffe2--nil -- Not needed at this time

Should I have done anything else here on this level to make it work? I’m building just for android.

Hi Tomaz,

Did you put that “xxxxxxxxxx” bit in the code so people here can’t see the appId? Or is that your actual running code?

Brent

I have just hidden the appId. Otherwise I have set it up correctly.

Tomaz

Can you build the Facebook sample app correctly and run it?

Next, it sounds like you are doing this on Android.  Facebook changed their login process to a two step permission request since the last public build (1137) which your account is listed as a Starter, so I’m assuming that’s the version you are running.  This login process is very difficult to handle in our Corona environment.  We have since fixed it and hidden that multi-phase login issue in a daily build that you don’t have access to.   But as mentioned in another forum thread this morning, the next public build is undergoing testing now should have a new public release out soon.  I can’t give an exact date because I don’t know how long testing will take nor do I know if they find a problem and have to fix it, how long that will add.

In the sample app I get no response. 

I have entered these two values

local appId = 286955538112894 -- Add your App ID here (also go into build.settings and replace XXXXXXXXX with your appId under CFBundleURLSchemes) local apiKey = 63b29592d2d84c3eb95ddc01c934ffe2--nil -- Not needed at this time

Should I have done anything else here on this level to make it work? I’m building just for android.