Facebook API and Open Graph v2 issues

I don’t know if this helps anyone, but just in case:
I was having problems reading permission settings (reading publish_actions in my case) which was causing problems in my app.

I noticed that Facebook changed the way in which they returned the permission info. So I had to recode how to read the response.

They might have changed other things too.

Also, Facebook now needs permissions requests to be submitted for approval via their developer’s site (the same way you submit stories for approval).

Jorge

Check here: https://developers.facebook.com/tools/explorer/
You can see here what are permissions names and what fields you can query.

I have latest public build and I must say that there was no problem on ios or android when graph api changed! You just must be aware that some permissions changed (default permissions are now optional), some were depreciated, there are app-scoped ids (no more global ones for new users), visible friends are only which play game and both of them granted friends permission.

You must remember that in corona on ios you need to use free plugin to use facebook (check documentation site)

To get name of user you must ask for field ‘name’

The question is which API version is implemented in the FB plugin for iOS !?

For Android, V2 is called from 2303…

V2

Is there a reason you are using network.request instead of facebook.request to get the permissions?

As far as I know the only recent change was to move to SDK v3.14 from V3.13 and you need to make two login calls to request the second set of permissions. 

Can you try and build the facebook sample app?

Rob

Rob, 

I just noticed some changes in daily build 2014.2292 to the facebook plugin/support… 

Update the iOS facebook project to use the latest facebook sdk. Also removed greenthrottle from enterprise. We're keeping facebook here instead of moving it to the plugins repo because we still want to package it with enterprise. iOS: The facebook SDK changed the location of the resource bundle. Pointing it to the new correct location.

Could you kindly tell us if we need to make any changes in our app to cater for this update? Thanks

As far as I know this has no impact on Corona SDK users and we didn’t change the location to avoid impacting Enterprise subscribers as well.  We were hoping Facebook would have fixed their IDFA issues, but that seems to still be an issue.

Rob

Ok. Getting close to releasing an app which is working for me in testing but worried about post-release issues. I ignored the IDFA stuff till now. Let me go do some reading up to understand what the problem is. Thanks

I’ve been encountering a similar issue since FB made the change to Graph 2.0 - I would recommend you or one of your testers who can currently log in and get the required permissions remove the app from your FB account (on Facebook.com, go to privacy settings–>apps and remove your app from the list of approved apps). This effectively clears out the access token and forces the app to request the necessary permissions again, as if for the first time. I suspect it won’t work after taking these steps - when I did this myself (I’m requesting “read_stream” and “publish_actions” in my app, though not at the same time), the only way I could get things working correctly again is to go into the Facebook Graph Explorer and get an access token manually. I’d be curious to hear if this is your experience as well.

Under Graph 2.0, it sounds like FB is implementing a review process for any app that want to request more than the most basic permissions (that would include “publish_actions”) - I copied this from https://developers.facebook.com/docs/facebook-login/permissions/v2.0#permission-publish_actions :

If your app asks for more than than public_profile, email and user_friends it will require review by Facebook before your app can be used by people other than the app’s developers.

In the FB Developer portal, there is now a “Status & Review” tab where you can submit a review request to grant your app the ability to request more sensitive permissions. Personally this seems like overkill to me - we have to endure a 1-2 week review process in order to request our users to grant us permissions? It’s an awful lot of hoops to jump through. And despite the fact that they claim that this review only applies to “people other than the app’s developers,” in my experience I’m still being prevented from requesting these permissions on my own account.

On the whole, I’m pretty unimpressed with the rollout of Graph 2.0 - all these hoops to jump through notwithstanding, they got rid of useful features like public post searching, which I was planning on using in an upcoming app. Grrrr. Stupid Facebook.

Please keep posting any findings related to this issue here - I was getting very close to releasing a heavily Facebook-integrated app, and now I’m thinking I’ve been set back weeks if not months on account of these very sudden changes to the way the FB API works. Any useful information from the community would be much appreciated!

Thanks,

Jason

@Rob - I have tried this with the corona facebook sample app and have the same problems. 

May  5 17:58:11 Craigs-iPad Facebook[3235] <Error>: +[FBSession isPublishPermission:]: unrecognized selector sent to class 0x3852ac

Same things applied, a user i created a month or so ago when i last played with the facebook sample app still works fine, but any new user (regardless of how i set them up) will result in the above error when the second login is called. So using the sample app, when you first start it it will automatically bring up the facebook login prompt, you put in the login details of a new user, it asks to auth the app you say ok, and the app loads and says logged in. As soon as you try to do any of the functions (like Post Msg), the code for that attempts a second login to get “publish_actions” permissions and you get the above error in the log and the function doesnt work. 

Tests were done with latest public release.

@Craig:

Can you try removing your app from your Facebook account in privacy settings, then re-logging in from your app? I’d be curious to see if you encounter the same issue I was: that even previously successfully logged-in accounts do not get tokens for anything beyond the most basic permissions when logging in for the first time? I suspect that this is a bug on Facebook’s end related to the new review process for extended permissions requests - they say that development teams should be able to access extended permissions without going through review, but that doesn’t seem to be the case. You can always add back the permissions manually by getting a custom token assigned to your account using the Facebook Graph Explorer (https://developers.facebook.com/tools/explorer/)

Thanks,

Jason

@Jason

You are correct, taking an older account that was working fine and removing the app from the privacy settings and then trying to use it now results in the problem of not being able to get any extended permissions. So the initial request on existing accounts seems to be returning the extended permissions by default, but a new account (or one that has had the app removed) will only allow basic permissions and will cause the error in my previous post when requesting extended permissions. 

Cheers

Hi All,

Same problem here.

I’ve got an app that’s pretty close to release, and now it seems there is no way to get extended permissions.

That’s a pretty big show stopper for me.

I suspect that going through the approval/review process with Facebook (which they advise will take 7-14 business days) will be how we get around this. But I’m still pretty miffed that we have to go through that headache in the first place - the user already has the ability to deny access, so why the arbitrary approval process? But regardless, it’s a bug that members of the development team can’t access these permissions with an app under development - it’s contrary to what Facebook’s own documentation would seem to suggest.

I’ll try to file a bug report with FB and will post any updates here - but if anybody at Corona Labs has a relationship with Facebook engineering and can sweet-talk them into fast-tracking a solution to this, I’m sure we’d all appreciate it. :slight_smile:

Thanks,

Jason

Facebook bug filed: https://developers.facebook.com/bugs/649529008416388/

Please check in and +1 it if you can…the more attention we can get from Facebook, the better!

Thanks,

Jason

I’m working on an app that incorporates social aspects for the first time, and Facebook’s stranglehold on the social media market is really bumming me out. Mostly because their, as Jason said, arbitrary approvals and the backflips developers need to perform in order to allow Facebook to work with their apps seems counter-intuitive. At this point, I’d rather leave Facebook out, and just use Twitter, G+, Tumblr, Mi5, Orkut etc without worrying about it.

I will be moving through the process of Facebook app approval just for documentation purposes, and I’ll report back with my findings. Jason, I went to your bug page, but I didn’t see a place to +1 it. Do I need to be a super-special Facebook developer in order to weigh in on it?

@Panc,

Thanks for checking it out. This is my first time reporting bugs to Facebook, so I’m honestly not sure what is available to 3rd parties in terms of +1ing - when I look at the report there’s a place for commenting, and since the bug report is public, I assumed everybody would be able to comment. But perhaps that’s not the case.

Sorry for the miscommunication, and thanks for pitching in!

Hi everyone, same issue for me… I don’t seem to be able to request Facebook extended permissions anymore (was working fine a couple of weeks ago).  I also assumed this was because my Facebook app now needs to go through a review process.  However, I removed all extended permissions that required a review process by Facebook.  I’m now only requesting the email extended permission, but event.response.email is nil in my Facebook listener.

@Rob, you mentioned that we now need to make a second login call as of V3.14 iOS Facebook SDK.  Is there a link to this in the Corona docs anywhere?  I can’t find any mention of this in the facebook.login() documentation:

http://docs.coronalabs.com/api/library/facebook/login.html

nor the Implementing Facebook documentation:

http://docs.coronalabs.com/guide/social/implementFacebook/index.html

If anyone can point me in the right direction, I’d be very grateful.  Here’s my code, for clarity:

[lua]  

        local function facebookListener( event )

            if not event.isError then 

                if event.type == “session” then

                    print(“event is session”)

                    if event.phase == “login” then

                        print(“logging in”)

                        sessionToken = event.token

                        sessionExpiry = event.expiration

                        print(event.token)

                        if sessionToken then

                            facebook.request( “me” )

                        end

                    end

                elseif event.type == “request” then

                    if not event.isError then

                        local fbResponse = json.decode(event.response)

                        print(“event is request”)

                        print("event.response = " … event.response)

                        print("event.response.email = " … fbResponse.email)

                    else 

                        local alert = native.showAlert( “Oh No”, “Facebook Connect Error!” , {“ok”} )

                    end

                end

            else 

            end

        end

        facebook.login( fbAppId,facebookListener,{ “email” })

[/lua]

@edmoyse,

I don’t personally use the “email” permission, so it could be I’m missing something, but taking a look at your code it looks like you are not decoding the JSON string that Facebook returns into a Lua table, which could be why event.response.email is nil. Try changing your code block that handles “request” event types (lines 15 through 23 in the example you pasted above) to the code below and let us know if it works. Don’t forget to include the JSON library by adding local json = require(“json”) somewhere in your code, or else the below won’t work:

elseif event.type == "request" then if not event.isError then local FBresponse = json.decode(event.response) print("event is request") print("USER EMAIL IS " .. FBresponse.email) else local alert = native.showAlert( "Oh No", "Facebook Connect Error!" , {"ok"} ) end end

Thanks for posting the bug. I found that there is a Reply box underneath your report so I placed a +1 blurb in there. All other devs can do the same I suppose although I have no idea whether FB will care or not. Again, thanks for taking the time.