Android: Facebook Login w/out native facebook app install fails. Error: loginCancelled

Already submitted this issue as a bug, just posting it here to see if any community members might have  some insight…

(This bug was experienced using Android 4.4.2 on a Nexus 7 device using CoronaSDK.2014.2189)

Whenever the native Facebook app is NOT installed on my device, and our app attempts a facebook.login request, the login ends prematurely with a ‘loginCancelled’ session status.

On the display, the end user sees a brief flash that appears to be a dialog window of sorts opening, which disappears as soon as the ‘loginCancelled’ response is received.

First, I skimmed some forum threads that mention this error. Most (if not all) of the solutions to the OP’s issues seemed to stem from (1) facebook-side configuration errors, (2) app-side configuration errors, or (3) an incorrect keystore hash.

So, after verifying our app settings, app id, etc, just to cover all my bases, I regenerated our release.keystore (Note: we also tested with the android debug.keystore, same results), generated the hash from the keystore, updated the hash on the facebook app’s settings page, and rebuilt our app using the new keystore. I tried about 5 minutes after updating the facebook settings and had no luck logging in. I thought maybe there might be some propagation period, so I waited 2 hours and tried again, to no avail. (Still not working several hours after update. And yes, it does include the ‘=’.)

Is there a particular version of OpenSSL I need to use when generating the hash? (I’m on OS X, but have access to Windows)

Our project utilizes the easyfb lib. Just to make sure that it wasn’t causing any complications, I created a test project (attached) that makes the facebook.login call directly, and I’m experiencing the same results. (My test call requires only the “basic_info” permission)

The kicker is that when the native facebook app IS installed the app is able to complete the login routine swiftly and consistently. (The other scenario we tested was devices with system-level facebook integration (such as an HTC one device) In that case, the app *was able* to log in correctly.)

No real issues to speak of on iOS. And Android works fine if there’s some sort of facebook account already associated with the device or the native app has been installed. Otherwise, I can’t seem to get my device to authenticate with facebook.

One other note is that once I’ve experienced the ‘loginCancelled’ event, I have to completely uninstall and reinstall the app before I can try again _with_ the native facebook app. If I try to login without the app. Install the facebook app. And then try again, the app gets stuck with a nativeActivityIndicator spinner. (The practical implication being that even if we recommended our users install the native fb app (which surely isn’t an option) but even if it was an option, they’d still have to reinstall our app to try again- so… not really a great solution.)

Conversely, if I achieve a successful login while the native fb app _is_ installed and then uninstall the native fb app, the cached token continues to work until I issue a .logout request. (expected behavior, I’m sure)

At this point I believe I’m out of troubleshooting options and any insight into this issue that might steer us in the right direction would be more than appreciated.

Note: if you try to run the attached files, don’t forget to update the SOME_FB_APP_ID references in main.lua & build.settings

I will just quickly put my 2 cents into this subject. I have run into a lot of snags when attempting to use Facebook in the past. I always post here thinking it has to be a bug with Corona, I know my settings are correct. I will say 99% of the time it is just Facebook being a POS. One day Facebook code doesn’t work, wait a week and it works fine. Failed logins and http 500 errors are both problems I have run into recently. I am not saying this is the case in your instance.

Quickly looking at your zip, I see you are asking for basic permissions when logging in. Facebook now requires you to log in without any permissions then later ask for permissions with a seperate login call. No idea why the app lets it go through, but it is no suprise seeing Facebook inconsistent with how things work.

@Anderoth:

Thanks for sharing your perspective on the situation. I definitely share your experience with facebook connect being unreliable, but usually it’s just in the form of fluke instances, not something that is consistent and reproducible such as what i’m experiencing with this issue.

I originally tried my sample code with no permissions, but added the ‘basic_info’ request after seeing it mentioned in another thread here. I’ve removed it once again, but I’m experiencing the same issue.

One thing I’ve noticed is that, in an Android AVD emulated environment, the in-app auth popup displays as expected. So I guess I’ll need to do some further testing to really narrow this one down.

I can’t believe that insisting that our users have the latest version of the fb app installed should be a requirement, but I can certainly see why it’s big blue’s preferred solution. :stuck_out_tongue: I can also see how Corona engineers might have their hands tied on this one.

Please see my response at the bottom of this thread:  http://forums.coronalabs.com/topic/44889-facebook-posting-on-android/

@Rob:

Thanks for your response. While trying out your mvp facebook connect code, I discovered the root of the issue.

Seems that I had the Facebook Messenger app still installed, while the Facebook app was uninstalled. This created the scenario where I was constantly receiving the “loginCancelled” event.

As soon as I uninstalled the Messenger app, the in-app auth modal showed as expected and I was successfully able to authenticate.

I had filtered my log messages prior, so I had missed the ActivityThread errors reported in the screenshot below.

I’m assuming this would be something on Facebook’s side of things at this point, but is there anything Corona engineering might be able to do to gracefully handle this exception?

Tracking event analytics show that enough of our users have experienced this issue for it to be a concern.

Thanks again!

Sidenote: Is there some way to update my existing bug report, or perhaps I should submit another one for this issue?

Screen%20Shot%202014-03-17%20at%205.17.4

If you still have the email that was sent to you from the bug reporting system, you can simply reply to it with your additional information.  If you have that bug number, then post it here. 

Rob

I will just quickly put my 2 cents into this subject. I have run into a lot of snags when attempting to use Facebook in the past. I always post here thinking it has to be a bug with Corona, I know my settings are correct. I will say 99% of the time it is just Facebook being a POS. One day Facebook code doesn’t work, wait a week and it works fine. Failed logins and http 500 errors are both problems I have run into recently. I am not saying this is the case in your instance.

Quickly looking at your zip, I see you are asking for basic permissions when logging in. Facebook now requires you to log in without any permissions then later ask for permissions with a seperate login call. No idea why the app lets it go through, but it is no suprise seeing Facebook inconsistent with how things work.

@Anderoth:

Thanks for sharing your perspective on the situation. I definitely share your experience with facebook connect being unreliable, but usually it’s just in the form of fluke instances, not something that is consistent and reproducible such as what i’m experiencing with this issue.

I originally tried my sample code with no permissions, but added the ‘basic_info’ request after seeing it mentioned in another thread here. I’ve removed it once again, but I’m experiencing the same issue.

One thing I’ve noticed is that, in an Android AVD emulated environment, the in-app auth popup displays as expected. So I guess I’ll need to do some further testing to really narrow this one down.

I can’t believe that insisting that our users have the latest version of the fb app installed should be a requirement, but I can certainly see why it’s big blue’s preferred solution. :stuck_out_tongue: I can also see how Corona engineers might have their hands tied on this one.

Please see my response at the bottom of this thread:  http://forums.coronalabs.com/topic/44889-facebook-posting-on-android/

@Rob:

Thanks for your response. While trying out your mvp facebook connect code, I discovered the root of the issue.

Seems that I had the Facebook Messenger app still installed, while the Facebook app was uninstalled. This created the scenario where I was constantly receiving the “loginCancelled” event.

As soon as I uninstalled the Messenger app, the in-app auth modal showed as expected and I was successfully able to authenticate.

I had filtered my log messages prior, so I had missed the ActivityThread errors reported in the screenshot below.

I’m assuming this would be something on Facebook’s side of things at this point, but is there anything Corona engineering might be able to do to gracefully handle this exception?

Tracking event analytics show that enough of our users have experienced this issue for it to be a concern.

Thanks again!

Sidenote: Is there some way to update my existing bug report, or perhaps I should submit another one for this issue?

Screen%20Shot%202014-03-17%20at%205.17.4

If you still have the email that was sent to you from the bug reporting system, you can simply reply to it with your additional information.  If you have that bug number, then post it here. 

Rob