Your code did not solve the Android issue for me. Also it makes the facebook login get called twice for whatever reason. Works on IOS, but not on Android.
I Agree what rxmarccall says its asking twice the app permission. The fb issue is not solved only the thing is that its getting posted at least . The problem that still exists is when we login the fb from the app its asking for the permissions twice and for the first time its not getting posted (if you have not previously approved the app permissions in the fb). After that when You again press the share button it gets posted.
I can say its just the temporary fix for now,actual problem still remains. Thanks for the temporary fix.
Yea, users are just going to be confused if they hit “post to facebook”, and nothing happens until they push the button a second time, which they won’t do.
Well your login process should be handling the 2nd login request. I would not tie it to a button for the users to have to hit and then hit again. Engineering is looking into to seeing if this is something that we can solve. No promises.
Gotta love Facebook.
Yea facebook is the worst haha. I never use it. Hoping that it will die a terrible death sooner rather than later. Might just leave it out of my apps, its more trouble than its worth it seems. thanks for the support as always.
I suspect they are still required, though I don’t know why you were able to work. Interesting. I’d make it match just to be safe.
The thing is that I can’t get the hash key in the logs. It all works without any problems. Might be some temporary bug or something.
I just generated the key using the console in the end, just to be safe.
They key you need to put on Facebook’s developer portal is: JGn9F2vDQ/w6hexLxdefCUpxYIA
The key it’s looking for is what it prints in the log.
The sniped I posted in my first post is an example from corona tutorials pages.
I’m not able to get that key in the logs.
I made more tests and it seems that the hash doesn’t matter when all the authentication happens with the native sdk within my app.
When I install the native Facebook application, everything breaks. And no has key is being output. I made a hashkey using both my keystore password and the password “android”.
I made all of this on mac. I’m gonna try on pc because I read somewhere that there’s a problem with sha1 on mac(?).
I’ll get back with my results.
Ps: I’m using last daily build 1161 and testing on Samsung Galaxy S3.
After spending many hours debugging this problem here’s what I found:
-
Everything works fine if there’s no authentication outside my app (either the user doesn’t have native Facebook app, or my app is build with corona version before updating to Facebook SDK 3.0.1)
-
The steps from here (http://docs.coronalabs.com/guide/social/setupFacebook/index.html#app-integration) can’t be reproduced anymore. The documentation is outdated from before the update to 3.0.1. So there’s no way to see in the console the hash. So…
-
I generated the hash keys on both Mac and Windows (tried latest 2 versions of openssl). Still nothing. (From my keystore, I didn’t use the debug one as most do and fail.)
-
I get this event even though I accept the permissions of the app:
type = session name = fbconnect phase = loginCancelled isError = false response =
-
From my research the problem is the invalid hash key, and noone seems to be able to generate it properly. They all used some code to make Facebook output the expected key.
So is there anyone having an Android app with Facebook integration that used a Corona build higher than 2013.1141 ?
@beckslash, I generated my FB key hash for my Android app using Terminal app on Mac not so long ago with the following command (where my app’s keystore is myapp.keystore and alias is myappalias):
keytool -exportcert -alias myappalias -keystore myapp.keystore | openssl sha1 -binary | openssl base64
I added it to my app’s page in FB Developer page. I’m using daily build 1158 (and plan on fetching a new one early next week.) So far, I haven’t seen problem with FB integration in my app on Android device. I wonder what might be causing you issues…
Naomi
I used the same command. And entered both my keystore password and a wrong one (it seems that that command only generates two hashes).
What device did you test on? I tested on Samsung Galaxy S3. I remember reading somewhere that on htc there’s no problem.
Also did you test with native Facebook app installed on the device?
@beckslash, my app’s keystore and alias use same password. I generated single key hash for each of my app. I tested my app on Nexus 7, Nexus 10 and Samsung Galaxy SIII. They are working as expected.
Naomi
Interesting. I tested with build 1158, still doesn’t work.
I noticed something weird. My Facebook app name is different than the Android app name. When I’m prompted it shows the android app name instead of the facebook name:

And the native permission dialogue looks a bit weird…just a regular alert hmm. Is it the same on your device?
That sounds odd. My FB app name is the same as my Android app name. And when I’m prompted it shows the FB native permission dialogue, not the regular alert. It seems like there’s something really odd going on with your app? Something not right with FB app setup at the FB Dev page, or something odd with your device build.
Are you using the android package name and its unique keystore (that pairs with FB key hash) when generating the device build?
Naomi
Yep. Checked a thousand of times and they are right.
This is what I get from the logcat:
W/fb4a(:\<default\>):BlueServiceQueue(12302): Exception during service W/fb4a(:\<default\>):BlueServiceQueue(12302): com.facebook.http.protocol.ApiException: The proxied app is not already installed. W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:78) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:107) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponse.h(ApiResponse.java:291) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:266) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:27) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:157) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:16) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.handler.PlatformOperationHandler.c(PlatformOperationHandler.java:366) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.handler.PlatformOperationHandler.a(PlatformOperationHandler.java:259) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:245) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:51) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:191) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.FutureTask.run(FutureTask.java:137) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.common.executors.HandlerExecutorServiceImpl$ListenableScheduledFuture.run(HandlerExecutorServiceImpl.java:268) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Handler.handleCallback(Handler.java:615) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Handler.dispatchMessage(Handler.java:92) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Looper.loop(Looper.java:137) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.HandlerThread.run(HandlerThread.java:60)
If I uninstall the native Facebook app from the device I get the FB native dialogue too. But with it on the device I get that. After I click ok I get this:
W/fb4a(:\<default\>):BlueServiceQueue(12302): Exception during service W/fb4a(:\<default\>):BlueServiceQueue(12302): com.facebook.http.protocol.ApiException: The app must ask for a basic\_info permission at install time. W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:78) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:107) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.ApiResponse.h(ApiResponse.java:291) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:266) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:27) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:157) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:16) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.handler.PlatformOperationHandler.c(PlatformOperationHandler.java:366) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.katana.server.handler.PlatformOperationHandler.a(PlatformOperationHandler.java:259) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:245) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:51) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:191) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) W/fb4a(:\<default\>):BlueServiceQueue(12302): at java.util.concurrent.FutureTask.run(FutureTask.java:137) W/fb4a(:\<default\>):BlueServiceQueue(12302): at com.facebook.common.executors.HandlerExecutorServiceImpl$ListenableScheduledFuture.run(HandlerExecutorServiceImpl.java:268) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Handler.handleCallback(Handler.java:615) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Handler.dispatchMessage(Handler.java:92) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.Looper.loop(Looper.java:137) W/fb4a(:\<default\>):BlueServiceQueue(12302): at android.os.HandlerThread.run(HandlerThread.java:60) W/fb4a(:\<default\>):GDPDialog(12302): Failed to send W/fb4a(:\<default\>):GDPDialog(12302): com.facebook.fbservice.service.ServiceException: API\_ERROR: API\_ERROR W/fb4a(:\<default\>):GDPDialog(12302): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:637) W/fb4a(:\<default\>):GDPDialog(12302): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:46) W/fb4a(:\<default\>):GDPDialog(12302): at com.facebook.fbservice.ops.BlueServiceOperation$2.run(BlueServiceOperation.java:602) W/fb4a(:\<default\>):GDPDialog(12302): at android.os.Handler.handleCallback(Handler.java:615) W/fb4a(:\<default\>):GDPDialog(12302): at android.os.Handler.dispatchMessage(Handler.java:92) W/fb4a(:\<default\>):GDPDialog(12302): at android.os.Looper.loop(Looper.java:137) W/fb4a(:\<default\>):GDPDialog(12302): at android.app.ActivityThread.main(ActivityThread.java:4898) W/fb4a(:\<default\>):GDPDialog(12302): at java.lang.reflect.Method.invokeNative(Native Method) W/fb4a(:\<default\>):GDPDialog(12302): at java.lang.reflect.Method.invoke(Method.java:511) W/fb4a(:\<default\>):GDPDialog(12302): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) W/fb4a(:\<default\>):GDPDialog(12302): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) W/fb4a(:\<default\>):GDPDialog(12302): at dalvik.system.NativeStart.main(Native Method)
Strange. I have no clue why you are getting this error…
I’m on Mac and using Corona daily build 1158, and all is working correctly on Android devices that I tested so far. You might want to google the error and see if anything comes up? If you are getting the error, I’m sure there are other devs who’ve dealt with the same issue sometime somewhere.
And… if you are 100% sure nothing is wrong with your app set up in FB Dev account, I wonder if your dev environment is causing problems – possibly due to your dev environment issue (if any), it’s not generating hash key properly?
Beyond that, I’m out of suggestions.
Naomi
Can you please test build the Corona SDK Facebook sample app and see if you’re having the same problems with it?
After debugging and searching for 3 days I figured it out.
Now facebook wants us to treat the reading and writing permissions separately. So you can’t mix reading and writing permissions. (By not specifying any permissions, fb still asks for basic reading permissions).
So first you have to ask for reading, then writing permissions. It doesn’t seem right to handle it this way. I’m not sure if that’s what they want to migrate to or it’s just a bug. But here’s a fix for it.
local function getPermissions(event) if(event.type == "session") then facebook.logout() facebook.login( fbAppID, fbListener, {"publish\_stream"}) end end facebook.login( fbAppID, getPermissions)
Hey, @beckslash, glad to hear you found and fixed the problem. About “publish_stream”, it is being deprecated (by Facebook.) You might want to replace it with “publish_actions”, which AFAIK permits the app to handle all that which “publish_stream” does plus more.
Naomi