It seems that the facebook plugin limits the ability to use facebook well. The simple case is when a user is already logged into facebook from a previous login. There is no way to prevent the switch over to the facebook app and back to the corona app (since you must always call facebook.login to setup the event listener). Also requiring all facebook events to run through the same event listener makes doing things in facebook much more difficult. Is there something we’re missing on using the previously logged in token without having to call facebook.login()?
Anything from the corona team on this?
Hi @rstupek,
Have you thoroughly read through the entire guide on implementing Facebook? There are details on login matters and more which may be relevant to your questions:
https://docs.coronalabs.com/guide/social/implementFacebook/index.html
Take care,
Brent
Hi Brent,
Yes I have definitely read through the documentation. There appears to be no way to use Facebook without the required switch away to the facebook app (or web page) since any interactions with Facebooks api through corona must be started by calling Facebook.login() to get the facebook listener setup. Since you can be technically logged into facebook already and have a valid useable access token (from a previous login when running the application before), you should be able to issue requests to facebook which would not require you to login again. I’m trying to get apprequests from facebook without every time our app running it has to switch away to facebook which leads to annoying user experience. I don’t see any other way to get the single event listener for all facebook api responses setup without calling login(). Am I missing something?
As long as the app is in memory (which on iOS should be the default), when you come back to it after having been backgrounded, then you’re existing token is still in place. Your defined listener is still in place as well, so you should not need to call login again until the token expires (around 60 days give or take Facebook’s mood).
The SDK requires a fast switch to the facebook app to login. This is normal expected behavior for the Graph API. If you want to use a login-less system, we have the social plugin (Android) and activity plugin (iOS) that will let you post to FB using the OS’s credentials that does not require the fastswitch that FB requires.
Now once the token requires, I’m not sure there is any way to detect it other than doing a facebook.request() call and see that it fails with a token error, which you could then call facebook.login() to relogin.
As far as a single listener, I’m actually going to agree with you. I’ve always wanted a call back on a per-request basis. But this is the way the way Facebook has been engineered into Corona SDK. Our engineers understand the underlying SDK way more than I do, and I will defer to their expertise.
Rob
Thanks for bearing with me but I don’t think I’m describing what the issue is well. I understand that it is required to switch away to login and I have no issue with that (except that it would be nice of course if it didn’t but I understand the limitation that facebook imposes). When the app starts running again at any time in that 60 day window the token would still be valid to do facebook.request calls (for something as simple as an apprequest call to get any outstanding requests to play the game made through facebook). The problem is the SDK offers no way to register the single event listener (again I’m not going to argue the limitations of the api as it exists with respect to this point which certainly makes any facebook work more difficult) except by calling facebook.login() which ends up switching away which isn’t a great experience for the user (they don’t know why the app is switching to facebook since they didn’t do anything to cause it). I hope I’ve done a better job explaining the issue.
Can I get you to add this as a feature request at http://feedback.coronalabs.com
Then post the link back here. We are working on updating the Facebook SDK to the latest and this may be the time to address this.
Thanks
Rob
Anything from the corona team on this?
Hi @rstupek,
Have you thoroughly read through the entire guide on implementing Facebook? There are details on login matters and more which may be relevant to your questions:
https://docs.coronalabs.com/guide/social/implementFacebook/index.html
Take care,
Brent
Hi Brent,
Yes I have definitely read through the documentation. There appears to be no way to use Facebook without the required switch away to the facebook app (or web page) since any interactions with Facebooks api through corona must be started by calling Facebook.login() to get the facebook listener setup. Since you can be technically logged into facebook already and have a valid useable access token (from a previous login when running the application before), you should be able to issue requests to facebook which would not require you to login again. I’m trying to get apprequests from facebook without every time our app running it has to switch away to facebook which leads to annoying user experience. I don’t see any other way to get the single event listener for all facebook api responses setup without calling login(). Am I missing something?
As long as the app is in memory (which on iOS should be the default), when you come back to it after having been backgrounded, then you’re existing token is still in place. Your defined listener is still in place as well, so you should not need to call login again until the token expires (around 60 days give or take Facebook’s mood).
The SDK requires a fast switch to the facebook app to login. This is normal expected behavior for the Graph API. If you want to use a login-less system, we have the social plugin (Android) and activity plugin (iOS) that will let you post to FB using the OS’s credentials that does not require the fastswitch that FB requires.
Now once the token requires, I’m not sure there is any way to detect it other than doing a facebook.request() call and see that it fails with a token error, which you could then call facebook.login() to relogin.
As far as a single listener, I’m actually going to agree with you. I’ve always wanted a call back on a per-request basis. But this is the way the way Facebook has been engineered into Corona SDK. Our engineers understand the underlying SDK way more than I do, and I will defer to their expertise.
Rob
Thanks for bearing with me but I don’t think I’m describing what the issue is well. I understand that it is required to switch away to login and I have no issue with that (except that it would be nice of course if it didn’t but I understand the limitation that facebook imposes). When the app starts running again at any time in that 60 day window the token would still be valid to do facebook.request calls (for something as simple as an apprequest call to get any outstanding requests to play the game made through facebook). The problem is the SDK offers no way to register the single event listener (again I’m not going to argue the limitations of the api as it exists with respect to this point which certainly makes any facebook work more difficult) except by calling facebook.login() which ends up switching away which isn’t a great experience for the user (they don’t know why the app is switching to facebook since they didn’t do anything to cause it). I hope I’ve done a better job explaining the issue.
Can I get you to add this as a feature request at http://feedback.coronalabs.com
Then post the link back here. We are working on updating the Facebook SDK to the latest and this may be the time to address this.
Thanks
Rob