Facebook loginCancelled

I have this problem for several weeks now… I followed all the guides to setup my facebook developer settings and whenever i try to login i get this annoying response. Please somebody help me.

Code…

local function listener( event ) local myText = display.newText("listener", 250, 50, native.systemFont, 30) local myText2 = display.newText(event.type, 250, 150, native.systemFont, 30) local myText3 = display.newText(event.phase, 250, 250, native.systemFont, 30) end local appId = "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*" if ( appId ) then facebook.login( appId, listener ) end

Response…

listener session loginCancelled

Build.settings…

-- For more details on this file and what you can do with it, look here: -- https://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { default = "landscapeRight", --content = "landscapeRight", -- Un-comment to lock to this orientation on iOS ONLY supported = { "landscapeLeft", "landscapeRight", }, }, android = { -- The version code must be an integer � it cannot contain any decimal points. versionCode = "1", -- Increase heap size from 32MB to device max (this setting is for Android 3.0 and higher. -- Android 2.x devices will still run the app but they'll ignore this setting.) largeHeap = true, usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", --"android.permission.ACCESS\_FINE\_LOCATION", --"android.permission.ACCESS\_COURSE\_LOCATION", -- Find more permissions here: http://developer.android.com/reference/android/Manifest.permission.html }, usesFeatures = { --{ name = "android.hardware.camera", required = true }, --{ name = "android.hardware.location", required = false }, --{ name = "android.hardware.location.gps", required = false }, -- Find more features here: http://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference } }, iphone = { plist = { UIAppFonts = { "Harrowprint.ttf", }, UIStatusBarHidden = true, UIPrerenderedIcon = false, --CFBundleIconFiles = { }, --MinimumOSVersion = "5.1.0", }, }, }  

Facebook Setup…

facebook4.png

Android Build…

android_build.png

Device: Samsung Galaxy S2 (Android)

24 hours and no answer???

Any gurus please?

My advice would be to look in your devices console log using “adb logcat”.  If you don’t know how to do that, or don’t have adb setup, please read:

http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

I suspect that you are not providing the right keyhash to Facebook.   In fact, you are building  using the “debug keystore” which is different that your release keystore and you are probably providing the hash of the release keystore to Facebook.  These have to match.   Even if you’re using the hash of the debug keystore, the debug keystore that Corona uses is a different file than the one Android provides.

If this is the case or if there are other issues it will be in the console log.    Your best bet is to use the keystore you plan to release with generate the keyhash of that keystore, plug that into Facebook and then build with that keystore.

Rob

This problem had become so annoying that i left it for a while and worked on other parts of my game and now i am back to it  :frowning:

I generated the key using the following method which i found online…

Here is what you need to do - Download openSSl from Code Extract it. create a folder- OpenSSL in C:/ and copy the extracted code here. detect debug.keystore file path. If u didn't find, then do a search in C:/ and use the Path in the command in next step. detect your keytool.exe path and go to that dir/ in command prompt and run this command in 1 line- $ keytool -exportcert -alias androiddebugkey -keystore "C:\Documents and Settings\Administrator.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary |"C:\OpenSSL\bin\openssl" base64

If you look at the path when you build for Android with Corona, it will show you (at least partially) the path to the debug keystore that Corona SDK uses.  I can see part of the path in your screen shot but it’s enough to know that what you did above is not going to work.

Above you used the file:  C:\Documents and Settings\Administrator.android\debug.keystore

Corona is trying to use:   C:\Program Files (x86)\Corona Labs\Corona SDK…  (I can’t see the rest…)

These debug.keystores are very likely different and therefore the hash generated from the keystore is going to be different and isn’t going to match what you are building against.   Since I can’t see the complete path, you need to use whatever that path is in your command.  If the file is where I think it is (I have a Mac so I’m guessing here), your command to generate the hash would be:
 

$ keytool -exportcert -alias androiddebugkey -keystore “C:\Program Files (x86)\Corona Labs\Corona SDK\Resource Library\Android\debug.keystore” | “C:\OpenSSL\bin\openssl” sha1 -binary |“C:\OpenSSL\bin\openssl” base64

But you will need to click that browse button and verify where this file really is.

Before you release your app, you will need to sign it with a release keystore and not a debug keystore.  You will have to repeat this process using your release keystore and then putting the keyhash for your release compiled version on Facebook.  From my experience, you probably should only build against the release keystore and go ahead and get Facebook working because you will likely forget this step when it comes time to release your app.

Rob

@Rob I followed your instruction and generated new key but still the same problem :frowning:

and in the device log there it doesn’t show anything…

d\android-sdk\platform-tools\>adb logcat Corona:v \*:s beginning of /dev/log/main (25175): \> Class.forName: network.LuaLoader (25175): \< Class.forName: network.LuaLoader (25175): Loading via reflection: network.LuaLoader (25175): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (25175): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (25175): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (25175): Loading OPTIONS file (25175): \ (parentGroup) (25175): |--\ background (25175): |--\ buttons (25175): |--\ overlay (27894): \> Class.forName: network.LuaLoader (27894): \< Class.forName: network.LuaLoader (27894): Loading via reflection: network.LuaLoader (27894): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (27894): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (27894): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (27894): Loading OPTIONS file (27894): \ (parentGroup) (27894): |--\ background (27894): |--\ buttons (27894): |--\ overlay beginning of /dev/log/system (31782): \> Class.forName: network.LuaLoader (31782): \< Class.forName: network.LuaLoader (31782): Loading via reflection: network.LuaLoader (31782): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (31782): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (31782): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (31782): Loading OPTIONS file (31782): \ (parentGroup) (31782): |--\ background (31782): |--\ buttons (31782): |--\ overlay

Please help me i am running crazy…

I’m not seeing the messages about the login not working?  Am I missing something?

Thanks

Rob

It is here…

local function listener( event ) local myText = display.newText("listener", 250, 50, native.systemFont, 30) local myText2 = display.newText(event.type, 250, 150, native.systemFont, 30) local myText3 = display.newText(event.phase, 250, 250, native.systemFont, 30) end

Response…

listener session loginCancelled

24 hours and no answer???

Any gurus please?

My advice would be to look in your devices console log using “adb logcat”.  If you don’t know how to do that, or don’t have adb setup, please read:

http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

I suspect that you are not providing the right keyhash to Facebook.   In fact, you are building  using the “debug keystore” which is different that your release keystore and you are probably providing the hash of the release keystore to Facebook.  These have to match.   Even if you’re using the hash of the debug keystore, the debug keystore that Corona uses is a different file than the one Android provides.

If this is the case or if there are other issues it will be in the console log.    Your best bet is to use the keystore you plan to release with generate the keyhash of that keystore, plug that into Facebook and then build with that keystore.

Rob

This problem had become so annoying that i left it for a while and worked on other parts of my game and now i am back to it  :frowning:

I generated the key using the following method which i found online…

Here is what you need to do - Download openSSl from Code Extract it. create a folder- OpenSSL in C:/ and copy the extracted code here. detect debug.keystore file path. If u didn't find, then do a search in C:/ and use the Path in the command in next step. detect your keytool.exe path and go to that dir/ in command prompt and run this command in 1 line- $ keytool -exportcert -alias androiddebugkey -keystore "C:\Documents and Settings\Administrator.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary |"C:\OpenSSL\bin\openssl" base64

If you look at the path when you build for Android with Corona, it will show you (at least partially) the path to the debug keystore that Corona SDK uses.  I can see part of the path in your screen shot but it’s enough to know that what you did above is not going to work.

Above you used the file:  C:\Documents and Settings\Administrator.android\debug.keystore

Corona is trying to use:   C:\Program Files (x86)\Corona Labs\Corona SDK…  (I can’t see the rest…)

These debug.keystores are very likely different and therefore the hash generated from the keystore is going to be different and isn’t going to match what you are building against.   Since I can’t see the complete path, you need to use whatever that path is in your command.  If the file is where I think it is (I have a Mac so I’m guessing here), your command to generate the hash would be:
 

$ keytool -exportcert -alias androiddebugkey -keystore “C:\Program Files (x86)\Corona Labs\Corona SDK\Resource Library\Android\debug.keystore” | “C:\OpenSSL\bin\openssl” sha1 -binary |“C:\OpenSSL\bin\openssl” base64

But you will need to click that browse button and verify where this file really is.

Before you release your app, you will need to sign it with a release keystore and not a debug keystore.  You will have to repeat this process using your release keystore and then putting the keyhash for your release compiled version on Facebook.  From my experience, you probably should only build against the release keystore and go ahead and get Facebook working because you will likely forget this step when it comes time to release your app.

Rob

@Rob I followed your instruction and generated new key but still the same problem :frowning:

and in the device log there it doesn’t show anything…

d\android-sdk\platform-tools\>adb logcat Corona:v \*:s beginning of /dev/log/main (25175): \> Class.forName: network.LuaLoader (25175): \< Class.forName: network.LuaLoader (25175): Loading via reflection: network.LuaLoader (25175): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (25175): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (25175): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (25175): Loading OPTIONS file (25175): \ (parentGroup) (25175): |--\ background (25175): |--\ buttons (25175): |--\ overlay (27894): \> Class.forName: network.LuaLoader (27894): \< Class.forName: network.LuaLoader (27894): Loading via reflection: network.LuaLoader (27894): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (27894): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (27894): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (27894): Loading OPTIONS file (27894): \ (parentGroup) (27894): |--\ background (27894): |--\ buttons (27894): |--\ overlay beginning of /dev/log/system (31782): \> Class.forName: network.LuaLoader (31782): \< Class.forName: network.LuaLoader (31782): Loading via reflection: network.LuaLoader (31782): \> Class.forName: CoronaProvider.licensing.google.LuaLoader (31782): \< Class.forName: CoronaProvider.licensing.google.LuaLoader (31782): Loading via reflection: CoronaProvider.licensing.google.LuaLoader (31782): Loading OPTIONS file (31782): \ (parentGroup) (31782): |--\ background (31782): |--\ buttons (31782): |--\ overlay

Please help me i am running crazy…

I’m not seeing the messages about the login not working?  Am I missing something?

Thanks

Rob

It is here…

local function listener( event ) local myText = display.newText("listener", 250, 50, native.systemFont, 30) local myText2 = display.newText(event.type, 250, 150, native.systemFont, 30) local myText3 = display.newText(event.phase, 250, 250, native.systemFont, 30) end

Response…

listener session loginCancelled