Facebook API and Open Graph v2 issues

Hi Guys,

Same issues for us.

This is a blocker.

If we use the facebook graph api explorer it works properly.

https://www.facebook.com/v2.0/dialog/oauth?response_type=token&display=popup&client_id=xxxxxxx&redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer%2Fcallback&scope=user_birthday%2Cuser_friends%2Cemail%2Cpublish_actions

if we asks for the extended permissions throught corona it doesn’t work.

facebook.login( self.fbAppID, onLoginComplete, {“publish_stream,email,user_birthday,user_friends”} )

We are asking to the cornona staff to have a look at it because we need to release or roll back to the corona stable release and use v.1 facebook graph apis.

Thanks in advance.

Filippo

@filippo - its already fixed, if you’ve recompiled since the 7th of may then you shouldn’t have the problem.  Don’t forget you actually need to make 2 requests to get extended permissions the first time for a new user, an initial login first, then check what permissions are missing and then a second login call with the missing permissions as params. 

@cjorgens79, do you have an example of this you could post please?

Thanks,

Ed

No, it’s not working, even though we’re asking only for email:

facebook.login(id, listener, {“email”})

No extended permissions required on login.

Did you try making 2 logins? (The first one without any extended permission, and then on the second one you request the extended permissions)

So you mean we should first login like this

facebook.login(id, listener)

and then

facebook.login(id, listener, {“email”})

when the first login returns?

That is indeed not the intention by Facebook. They require 2 logins if you need _extended_ permissions, as in being allowed to post on the behalf of the user etc. Our login simply asks the user to allow us to get his email address, and that is not extended permissions.

Yes, try that.

I had that problem in an app and this solution worked for me.

I did some testing with build 2300 and the Facebook sample app and I’m not sure what you’re seeing when you say it’s broken. I was able to log in to Facebook and post a message. I tested this on an actual device (iPhone5 running iOS7).

Please use the bug reporting forms so we get the bugs in our system. We can’t track bugs that are posted in the forums.

We need to know the device you’re testing on; the OS version; if you have the Facebook app installed; and the steps to reproduce the problem and the results you’re seeing. If the bug can’t be reproduced with sample Facebook app, please attach a complete zipped test project that we can use to reproduce the bug.

Thanks,

Tom

@haakon - Email is indeed an extended permission, if you log into the FB dev portal, goto graph explorer, then click Get Access Token then click on the Extended tab you will see the email permission there. You need to do a second login asking for email permissions once the first login has succeeded.

Did you try what I described in this thread? (tested with your sample app)

http://forums.coronalabs.com/topic/47694-facebook-nasty-bug-checked-with-your-facebook-sample-app/#entry246845

Hi,

I’m looking into this now. I found one breaking change - doing a request for /me with fields specified throws an error. The username field is deprecated in the new facebook graph api. Our app was relying on the Facebook username. I have changed that now to rely on the first_name instead and it works.

So - this does no longer work: facebook.request("/me", {fields=“username”}).

That is not Corona’s fault. But if you could please return some usable error messages, and not just com.facebook.error 5 or whatever it says, things would be A LOT easier. As it is now, everything regarding Corona + Facebook debugging is a huge guesswork.

I have one more issue with getting specific fields for /me/friends, looking into that now.

@Haakon - if your after the full name you can use “name”. If you need something unique to keep track of, use the facebook "id’ field which you get back with every query from memory. The FB Graph Explorer is extremely useful for quickly and easily testing your queries and seeing what data you can get. 

I am confused now. This is on Android.

Using latest daily build 2300.

One login request:

facebook.login(FB_ID, facebookListener,{ “public_profile” })

and in the login event.phase

local params = {fields = “id,username”}
facebook.request(“me”, “GET”, params)

and this works! I am getting the username!?

From what daily build is Corona using Facebook v2 ?

If you login to facebook with a user who you have previously logged in with and allowed extended permissions, everytime you login you will be automatically given those same permissions. The only time the second login is really required is for first time use for a new user or when you ask for permissions you have never asked for before. 

A developer can use either the old or new versions as they have just changed the url scheme. Im not sure however what the facebook.request function does, it may now automatically append the v2 url scheme, someone from corona would have to weigh in on that. I dont personally use facebook.request however, i use network.request instead which gives me more control of the url and listeners. 

If you make use of the old api version then the old username option would still work, however the old api will be deprecated in 12 months, so you are better off using the v2 api as this has a 2yr life from the point they release 2.1 or higher. After which point any calls are automatically pushed up to the next non-deprecated api version. 

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

So if I want to post a photo to a Facebook wall via facebook.request( “me/photos”, “POST”,attachment), I have to request some permissions be approved on the Facebook developer portal?

While you’re developing you can create a test app and use test users and not request the permission, but it will have to be approved before you go live.  Also, if you have an older AppID I think you’re good.  I’m not sure when Facebook changed to this requirement.

but to sum it up, Yes.

Rob