Hi guys,
I may have found a fix for this problem. First of all: the problem only affects some facebook accounts. One of my test accounts is working fine while the other one fails every time.
I am using latest public release 2907 and official facebook example.
First login attempt works fine for me, but the second one, the one you trigger by clicking “Get User” button, always fails with loginCancelled event.
I simply patch enforceLogin() function as follows:
local function enforceFacebookLogin( ) if facebook.isActive then local accessToken = facebook.getCurrentAccessToken() if accessToken == nil then print( "Need to log in" ) facebook.logout() -- PATCHED CODE facebook.login( listener ) elseif not inTable( accessToken.grantedPermissions, "publish\_actions" ) then print( "Logged in, but need permissions" ) printTable( accessToken, "Access Token Data" ) facebook.logout() -- PATCHED CODE facebook.login( listener, {"publish\_actions"} ) else print( "Already logged in with needed permissions" ) printTable( accessToken, "Access Token Data" ) statusMessage.textObject.text = "login" processFBCommand() end else print( "Please wait for facebook to finish initializing before checking the current access token" ); end end
I inserted facebook.logout() statement just before facebook.login(…)
This change prevent loginCancelled event, and everything seems working fine. Please test and share your results.