I’ve been searching for this problem days ago. Someone said that is because the generated key hash may not be right in Window, so I tried different versions of openssl but all of them generated the same key hash (in both Window 32 bit and 64 bit). To express my problem clearer, let’s call this old key hash ‘X’. Then I used a software to generate key hash, this time it returned a different one, let’s call this new key hash ‘Y’.
When I used key hash X, my facebook account was able to post normally, but for different facebook users, it always returns ‘login cancelled’. I’m finding fb4a/facebook/blueservice and corona messages in adb but I can’t see any of them… (I typed in adb logcat, the text goes so fast I may missed them :o , adb logcat corona:v *:s doesn’t show anything)
When I used key hash Y, my facebook account couldn’t post, facebook returned something like ‘key hash X (my old key hash) doesn’t match any store key hash’. And other facebook users couldn’t login or authorized to do anything.
Someone said they could get a right key hash in Mac, but I don’t have one, so I don’t know which way I could try to fix this ‘login cancelled’ problem.
Here is the build.settings
settings = { plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, }, orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", "portraitUpsideDown"} }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { -- For iOS 9+ only NSAppTransportSecurity = { NSExceptionDomains = { ["fbcdn.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["facebook.com"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["akamaihd.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, }, }, LSApplicationQueriesSchemes = { "fb", "fbapi20130214", "fbapi20130410", "fbapi20140410", "fbapi20140116", "fbapi20150313", "fbapi20150629", "fbauth", "fbauth2", "fb-messenger-api20140430", }, -- For all version of iOS. CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work FacebookAppID = "myappID", -- replace XXXXXXXXX with your facebook appId CFBundleURLTypes = { { CFBundleURLSchemes = { "fbmyappID", -- replace XXXXXXXXX with your facebook appId } } } } }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, facebookAppId = "myappID", }, }
listener function
if ( "session" == event.type ) then if event.phase=="logout" then statusMessage.textObject.text="logged out" end if event.phase=="login" then statusMessage.textObject.text="logged in" local sendscore = loadFile("highScore.txt") local attachment = { name = "", link = "http://play.google.com/store/apps/details?id=myapppackage", description = "" , picture = "", actions = json.encode( { { name = "", link = "http://play.google.com/store/apps/details?id=myapppackage" } } ) } facebook.request( "me/feed", "POST", attachment ) end if (event.phase=="loginFailed") or (event.phase=="loginCancelled") then statusMessage.textObject.text="login failed" end --checking status if event.phase ~= "login" then statusMessage.textObject.text = event.phase end
statusMessage display: login cancelled.
I try to login with this code:
facebook.login( facebookAppID, listener, { “user_friends”, “email” } )
facebook.login( facebookAppID, listener, {“publish_actions”, “email” })
