Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Facebook frustrations
Started by Rob Miracle Jul 27 2013 12:33 PM

90 replies to this topic
[TOPIC CONTROLS]
« Page 4 of 4 2 3 4
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#76

christian.enchelmaier

[GLOBAL: userInfoPane.html]
christian.enchelmaier
  • Observer

  • 27 posts
  • Enterprise

Hi Rob,

 

I thought I'd chime in and try to share with you and others what I think is the status with Facebook right now.  There are a number of similar but distinct issues, a fair bit of misinformation (partly spread, unfortunately, by me in this thread: http://forums.coronalabs.com/topic/37400-facebook-login-flow-on-android-broken-since-daily-build-1141/#entry195068), and of course some situations where blame is being placed on Facebook when it's actually bugs in our own code.

 

For me, the bottom line is that Facebook is working fine (starting in Build 1158).  I've been able to integrate everything I was looking to do, which includes basic and publishing permissions on both iOS and Android with a successful and user-friendly login flow (regardless of whether or not the Facebook app is installed), and graceful handling of situations when the app is deauthorized / permissions are rescinded.  But this wasn't without some work.  I ended up writing a module that wraps the Corona facebook API to enable some critical additional functionality, described more below.

 

But first, here's what I think are the challenges that folks are facing:

  • Requesting Additional Permissions
    • By requesting additional permissions, I mean situations where the app asks for certain permissions at one point, and later needs to ask for more permissions.  There are two main use cases for this:
    1. As a best practice, apps should only request permissions from users as and when the app actually needs them.  Many users will be put off if they try to take a simple facebook action, and the app asks for the kitchen sink of permissions that it obviously doesn't need at that point
    2. In certain cases (described more below), Facebook is now requiring that apps cannot even request extended permissions, such as publish_actions, until they've first been granted some basic reading permissions like basic_info.  Thus, in these cases, the first call to facebook.login() cannot include an extended permission.  But if the app needs it, then there needs to be a way to request additional permissions later
    • The problem is, while the facebook.login() API lets us specify what permissions to ask for, the API doesn't appear to provide an obvious way to request additional permissions after an initial successful login.  The way to do it is to call facebook.logout() and immediately call facebook.login() with the additional needed permissions.  But this isn't obvious to many in the community, and it feels awkward (largely because it doesn't jive with the names 'login' and 'logout').
  • Changes to Android Login Flow
    • Build 1141 made a critical update to Corona's Facebook integration on Android.  Prior to that Build, I suspect that Corona's integration worked only through webViews, with no linkage to the Facebook app.  Starting in Build 1141, Corona began using the Facebook app for login flow, if it's installed.  This had two confusing consequences:
  1. First, whereas previously the login dialogs would appear in a nice looking webView, now they appear in a native alert (which don't offer the user an option to change the privacy settings of extended permissions).  This looked like a bug to me, hence the thread I mentioned above, but in fact, it's how Facebook's app for Android handles the login flow (see screenshots here: https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/#overview).
  2. Second, the Facebook app for Android requires that an app have basic reading permissions, such as basic_info, before requesting extended publishing permissions, such as publish_actions.  The webView flow doesn't require this.  Thus, before Build 1141, a call like facebook.login(appId, listener, {"publish_actions"} would work as the first call to facebook.login(), but starting in Build 1141, it would fail.
  • Facebook Dialog Response
  • "Do if Permitted, Otherwise Get Permission"
    • The Corona facebook API doesn't have a built-in "do if permitted, otherwise get permission" mechanism.  By this I mean a mechanism that only performs a facebook request if the user is logged in and the app has the necessary permission to complete the request.  If the user isn't logged in or doesn't have the necessary permissions, the mechanism would first login them in or request the permissions, and if that succeeds, only then perform the request.
    • This is a pretty important piece of functionality that requires keeping track of the permissions the app has been granted and knowing what permissions are required for a request.  It's one of the elements I had to build into my own wrapper module
  • Callbacks Per Action
    • ​The Corona facebook API doesn't have a mechanism to register a callback for each call to the API.  Instead, we have to provide a listener to facebook.login() and use that listener for all subsequent calls to the facebook API.  This creates challenges to many users, including:
      1. How to implement a "do if permitted, otherwise get permission" mechanism
      2. How to handle the facebook.logout() / facebook.login() strategy mentioned above to get additional permissions after an initial login

I think we're seeing a lot of issues come up in the forums largely because dealing with all of these issues isn't trivial.

 

I've seen some other threads citing issues with uploading pictures to Facebook, but that's not something I do, so I don't know if there's a real problem there or if it's just a symptom of one of the above points.

 

I hope this (admittedly long!) post helps bring some clarity to the situation.

 

- Andrew

 

Hey Andrew, hey Rob,

 

I totally agree with Andrew. Most of the problems are confusions in how to handle the API correct.

Additionally there are so much libraries that handle the API wrong, too or just for a certain purpose.

 

I learned the ropes in the API handling to write my own Facebook code and could get everything work - except the image upload with an additional message, as described in my blogpost: http://forums.coronalabs.com/topic/51699-post-photo-to-facebook-using-facebookshowdialog/

 

In a nutshell: Uploading images works with the request() function, but Facebooks current policy does not allow to add a message / text to the photo. The only chance we have to give the user this feature is to enhance the ShowDialog() with positng images, because adding messagen "in Facebook" is allowed.

 

@Rob Miracle: Do you see a chance to get this implemented?

 

Best regards

   Chris



[TOPIC: post.html]
#77

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,263 posts
  • Enterprise

Can you try again, I know we just did a fix to the Facebook plugin around image handling yesterday or the day before.  If not, I can ask engineering to see what can be done about it.  If it's not too difficult, they might be able to address this now that we are kind of coming out of this iOS 8 crunch mode we are in.

 

One of the problems is that Facebook changes their rules too fast and it takes considerable engineering and support efforts to stay atop their changes.   We know a lot of people use Facebook, but we have to balance the engineering time to all the other things we do too.  So no promises.  See if the new plugin fixes this and if not, bump this and I'll talk with the engineers.

 

Rob



[TOPIC: post.html]
#78

christian.enchelmaier

[GLOBAL: userInfoPane.html]
christian.enchelmaier
  • Observer

  • 27 posts
  • Enterprise

Can you try again, I know we just did a fix to the Facebook plugin around image handling yesterday or the day before.  If not, I can ask engineering to see what can be done about it.  If it's not too difficult, they might be able to address this now that we are kind of coming out of this iOS 8 crunch mode we are in.

 

One of the problems is that Facebook changes their rules too fast and it takes considerable engineering and support efforts to stay atop their changes.   We know a lot of people use Facebook, but we have to balance the engineering time to all the other things we do too.  So no promises.  See if the new plugin fixes this and if not, bump this and I'll talk with the engineers.

 

Rob

 

Hi Rob,

 

thanks for your reply.

 

I could not figure out any changes with the latest daily build. Currenty I am testing on Android.

 

Based on the current Facebook policies we should enhance the showDialog() function with the ability to upload a photo from the app including some nice text.

Why? Facebook does not allow to upload a photo with autogenerated text directly from the app, even if the user has the chance to edit the text in the app!
 
For everyone why just want to upload a photo to the users wall the followong code works fine (do not forget the permissions {"publish_actions", "user_photos"}  on login):
local attachment = {source = {baseDir="photo_dir", filename="photo_file", type="image"}}
facebook.request("me/photos", "POST", attachment)

You can also add the "name"-property to set a message - works perfectly but no go from Facebooks review team!

 

 

So, we need someting like this to pass Facebooks App Reviews to upload a picture to users wall including some text per Facebook embedded dialog:

 

facebook.showDialog( "feed", {redirect_uri = "www.website.com", link = "www.website.com",
            picture = { baseDir=msg_photo_dir, filename=msg_photo_file, type="image" },
            name = "name", caption = "Caption", description = "Description"})
 
Rob, I hope this description helps so far? Do you think your Team can handle that?
 
Best regards
   Chris


[TOPIC: post.html]
#79

appstore3

[GLOBAL: userInfoPane.html]
appstore3
  • Observer

  • 5 posts
  • Corona SDK

Hi Guys,

 

For allowing user to like game's Facebook page, we redirect user to respective face book page through browser. Now, here comes the problem.

If I am logged in to facebook's native app through LOGIN A and on browser through LOGIN B, after redirecting to browser and liking the page the like information will get displayed on the timeline of LOGIN B instead of LOGIN A. The opposite of which should be the case. 

 

Is there any provision to open facebook's URL with native logged in user's id?

 

Please Help.

 

 

Regards and Thanks



[TOPIC: post.html]
#80

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Hi Rob,

 

I have a problem with facebook v2 login flow with extended permissions.

There are 4 states:

1. User has no permission
I can ask user to give permissions to app, throug facebook.login function().

2. User accept basic info, but "skip" extended permissions
I can ask user again to give permissions to app, throug facebook.login function().

3. User accepts basic/extended permissions
All works fine.

4. In API v2, facebook introduces possibility to "deny" permissions to app (Different from skip). <-- PROBLEM
In this case, in the Facebook API there is a param called "auth_type: rerequest" that need to be sent in login process, so app can ask user for those permissions again.

Currently, is there a way in corona to do that "rerequest"?
I have tried everything, denied extra permissions are never asked again.

Sorry for my basic english.
Thank you

Any suggestions on this?

Four days, I have tried everything!

Thank you



[TOPIC: post.html]
#81

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,263 posts
  • Enterprise

Hi @felipebotero.  You posted this on a Friday.  Here in the US, most people work Monday-Friday, but this week, Monday was a holiday.  Today is the first day that Engineering would have a chance to have even seen my message.  Please be patient.

 

Rob



[TOPIC: post.html]
#82

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Hi @felipebotero.  You posted this on a Friday.  Here in the US, most people work Monday-Friday, but this week, Monday was a holiday.  Today is the first day that Engineering would have a chance to have even seen my message.  Please be patient.

 

Rob

 

I apologize, I'm desperate with this problem. 
I'll be waiting patiently ... :)


[TOPIC: post.html]
#83

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,263 posts
  • Enterprise

Have you tried calling facebook.logout() and then try logging in again to see if you can re-prompt them?



[TOPIC: post.html]
#84

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Have you tried calling facebook.logout() and then try logging in again to see if you can re-prompt them?

Yes, I already tried that... but permissions are not prompted again.

As I said before, this is a new "feature" since Facebook API 2.0, more info here:
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#handling

At this moment, I think there is no way with corona to make that call...
I'm using GET /{user-id}/permissions endpoint too, to obtain which permissions has been granted.

But there is no way to do this auth_type: 'rerequest' call.

regards
 



[TOPIC: post.html]
#85

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Yes, I already tried that... but permissions are not prompted again.

As I said before, this is a new "feature" since Facebook API 2.0, more info here:
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#handling

At this moment, I think there is no way with corona to make that call...
I'm using GET /{user-id}/permissions endpoint too, to obtain which permissions has been granted.

But there is no way to do this auth_type: 'rerequest' call.

regards
 

Hi Rob... any news on this?

 

Thank you



[TOPIC: post.html]
#86

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,263 posts
  • Enterprise

No news that I've heard. 

 

Rob



[TOPIC: post.html]
#87

krystian6

[GLOBAL: userInfoPane.html]
krystian6
  • Contributor

  • 560 posts
  • Corona SDK

Hmmm

I might be missing something, but you can get permissions using Corona:

facebook.request("/me", "GET", { fields = "permissions" })

Don't shoot if I lost track of something in this thread ;)



[TOPIC: post.html]
#88

felipebotero

[GLOBAL: userInfoPane.html]
felipebotero
  • Observer

  • 6 posts
  • Corona SDK

Hmmm

I might be missing something, but you can get permissions using Corona:

facebook.request("/me", "GET", { fields = "permissions" })

Don't shoot if I lost track of something in this thread ;)

 

Yes, permission status can be obtained this way... but if some of them are explicity "denied", there is no way to make a new login call with auth_type: 'rerequest' param... like facebook documentation states.

 

regards.
 



[TOPIC: post.html]
#89

sajoga

[GLOBAL: userInfoPane.html]
sajoga
  • Observer

  • 9 posts
  • Corona SDK

Hi everyone!

 

I'm not completely sure if this is something Facebook specific or is just about the configuration of the project but, is it possible NOT to show Facebook app login screen when login from an app?

 

In the project I'm working, once the user had logged to Facebook, the "autologin" feature is on, so it will automatically login to FB at the title screen when launched, but I want in that case NOT to switch to Facebook app (or browser) when it happens (it opens Facebook app, login and go back to app) . Is there any way to avoid this? Is something Facebook related or is about app configuration?

 

Thanks a lot!



[TOPIC: post.html]
#90

Skartechnologies

[GLOBAL: userInfoPane.html]
Skartechnologies
  • Observer

  • 13 posts
  • Corona SDK

I'm simply just trying to post a score.
When I use the Social plugin for facebook it works for iOS. On Android I get a "share via list" with no facebook option. I've searched to put facebook on list to no avail.  When I use the Facebook library it work for older androids but newer androids get error message that app is not installed correctly. Re-installing FB, accepting all options does not help.  Your sample FB app behaves the same way for me.  Is this common at this time for FB,
 
function showFacebook()
        local gameScore = score.get() ---getScore()
        local FBAppID = "removed for example"
        local buttonClickSound = audio.loadSound("SoundButtonClick.wav")
        audio.play(buttonClickSound)
        fbbutton.isVisible = false      
        local options = {
            service = "facebook",
            message = "Just Scored  " .. gameScore .. "  on ----------  V1 Beta !!!"
            image = {
                { filename = "HBpic.jpg", baseDir = system.ResourceDirectory }
            },
            url = ""
        }      
        native.showPopup( "social", options )
    end
 
Where can I find a working snippet just to post a score on FB that works on iOS and Android reliable?
 
 
By the way, you guys are great. I appreciate the work you put into this.



[TOPIC: post.html]
#91

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,263 posts
  • Enterprise

@sajoga I'm not aware of a way to avoid the facebook login prompt.

 

@Skartechnologies, the social plugin does not work on Android for Facebook.  Its a known Google/Facebook issue.  You will need to use the Facebook API there to do this.  What do you mean by "Older androids" and "newer androids"?

 

Rob




[topic_controls]
« Page 4 of 4 2 3 4
 
[/topic_controls]