Facebook frustrations

Seems like the solution is to not have the facebook app installed, and let it work through the webView.  But then again, once you’re logged in to the browser, it might keep you logged in.

Yes I tried that as well, it does.  So what does facebook.logout() actually do?  Am I crazy for thinking it should log you out and let the next person log in?

When your app logs into facebook, an auth token is generated that indicates your app is logged into facebook.  What facebook.logout() does is log your app out of facebook’s connect system. It has no effect on a user being logged into facebook. 

Ok. So seeing that it is possible in native iOS as well as phonegap apps, there has to be a way to do it in Corona. I have a commercial product that’s 99% ready for release and is being held up by this one issue. Is there any way to address this with the development team? I’d gladly pay for the support option for direct communication if it is possible to get this implemented.

I’ll ask Engineering.

I’ll ask.  Do you have to have the native app (since it’s a kiosk, you can control its existence) and just do your FB work through the browser?

Well, it’s run as a kiosk, but it’s a commercial product, so I am not really in control of the user’s devices this will be running on. Most users will have the native app installed, so I forsee a lot of headaches if I make uninstalling it a requirement. I actually don’t need to do anything but ask the user for their login credentilas inside of the corona app, log in to FB, grab the token and immediately log out.  No other FB interaction is necessary.  It’s a client server setup with a upd connection to the server, so I return the token to the server and the uploading to FB happens on a pc.  I just need to be able to logout of FB so the next person can log in.  I am willing to make it worth their while so to speak, as it’s the only thing holding up the release of the product and the thought of starting from scratch to make a native app on both platforms is not something I am looking forward to doing.  So if it comes to that, I can chat offline about what it would take.

Can you provide me information on other apps you’ve seen do this?  Are there any references you’ve seen on facebook to think this is possible?

It sounds like what you want is to use

https://developers.facebook.com/docs/reference/android/current/SessionLoginBehavior/#SUPPRESS_SSO

instead of

https://developers.facebook.com/docs/reference/android/current/SessionLoginBehavior/#SSO_WITH_FALLBACK

I recall being able to log out of the native FB app back when I was doing Phone Gap apps, but in looking for example iOS apps, I have found that the apps that are doing what I’m trying to do are using a popup window to ask for the FB login credentials and not using the native app.  So, yes, not doing it with the native app is fine as long as I can not automatically launch the native FB app and use a browser dialog even if the native app is installed.

An example of an app that is doing exactly what I am doing is: https://itunes.apple.com/us/app/picpic-social/id611055461?mt=8&uo=4

A quick note to report that the frustration I was having with Android version of my app as it relates to FB is fixed as of daily build 1179.  Thank you, Corona Labs Android Team.  I think they’ve worked out the solution so that we don’t have to do the heavy lifting  and write out the workaround on our end.  (The fix was for case #25128.)

Cheers,

Naomi

And here’s how phonegap does it.  https://github.com/phonegap/phonegap-facebook-plugin

They are using the FB Javascript SDK

https://github.com/phonegap/phonegap-facebook-plugin/blob/master/www/facebook-js-sdk.js

[lua]

/**

* Logout the user in the background.

*

* Just like logging in is tied to facebook.com, so is logging out – and

* this call logs the user out of both Facebook and your site. This is a

* simple call:

*

* FB.logout(function(response) {

* // user is now logged out

* });

*

* NOTE: You can only log out a user that is connected to your site.

*

* @access public

* @param cb {Function} The callback function.

*/

  logout: function(cb) {

    FB.ui({ method: ‘auth.logout’, display: ‘hidden’ }, cb);

  }

[/lua]

which calls logout in https://github.com/phonegap/phonegap-facebook-plugin/blob/master/src/ios/FacebookConnectPlugin.m

[lua]

  • (void) logout:(CDVInvokedUrlCommand*)command

{

    if (!FBSession.activeSession.isOpen) {

        return;

    }

    

    // Close the session and clear the cache

    [FBSession.activeSession closeAndClearTokenInformation];

    

    CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];

    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];

}

[/lua]

Having issues with facebook login, here’s what you asked

Android Version : 4.1.2

Corona Version:  1137

Facebook operations:  Posting a message

Needed permissions:  i put publish_actions

 

when I hit a “share with facebook” button in my app, the facebook app on my phone launches, tried to load, but closes and returns back to my app.

 

I’ve generated a key hash, put in the developer page and used the appropriate keystore that I used to generate the key hash

 

I tried building the facebook sample app provided by Corona and got this in the adb 

 

What am I doing wrong?

I/Corona  ( 6274): Facebook Listener events: I/Corona  ( 6274):    type(session) I/Corona  ( 6274):    name(fbconnect) I/Corona  ( 6274):    phase(loginFailed) I/Corona  ( 6274):    isError(true) I/Corona  ( 6274):    response(Failed to receive ac ... #31) I/Corona  ( 6274): event.name    fbconnect I/Corona  ( 6274): event.type:    session I/Corona  ( 6274): isError: true I/Corona  ( 6274): didComplete: nil I/Corona  ( 6274): Session Status: loginFailed

Turns out the problem only occurs when native Facebook App is installed on my phone. 

Read that this gets fixed in a later daily build. Though I am not too thrilled about waiting to get this App live. 

Any luck checking out that other app and/or seeing how the Phonegap plugin works to allow for a dialog to login and still manages to logout?

Just checking in if there is any thoughts from engineering in getting a way to log out of the native fb app?

I’ll ask.  Do you have to have the native app (since it’s a kiosk, you can control its existence) and just do your FB work through the browser?

Well, it’s run as a kiosk, but it’s a commercial product, so I am not really in control of the user’s devices this will be running on. Most users will have the native app installed, so I forsee a lot of headaches if I make uninstalling it a requirement. I actually don’t need to do anything but ask the user for their login credentilas inside of the corona app, log in to FB, grab the token and immediately log out.  No other FB interaction is necessary.  It’s a client server setup with a upd connection to the server, so I return the token to the server and the uploading to FB happens on a pc.  I just need to be able to logout of FB so the next person can log in.  I am willing to make it worth their while so to speak, as it’s the only thing holding up the release of the product and the thought of starting from scratch to make a native app on both platforms is not something I am looking forward to doing.  So if it comes to that, I can chat offline about what it would take.

Can you provide me information on other apps you’ve seen do this?  Are there any references you’ve seen on facebook to think this is possible?

It sounds like what you want is to use

https://developers.facebook.com/docs/reference/android/current/SessionLoginBehavior/#SUPPRESS_SSO

instead of

https://developers.facebook.com/docs/reference/android/current/SessionLoginBehavior/#SSO_WITH_FALLBACK