David, can you go ahead and file a bug report with your test case. Make sure to include the build.settings and config.lua and any assets needed and bundle in a .zip file.
Thanks
Rob
David, can you go ahead and file a bug report with your test case. Make sure to include the build.settings and config.lua and any assets needed and bundle in a .zip file.
Thanks
Rob
Sure thing Rob - I’ve just submitted that for you guys… Hopefully it will be something easy to fix
Case 34943
Cheers
Dave
It seems like Dave beat me to filing the bug, but it seems like I’m the only one experiencing the ‘Facebook SDK error 5’ error so I might file another bug as well. I’ll see if I can strip my code and replicate it. I’ll keep you guys updated on this.
Bug was filed: Case 34982
Hi Rob,
Do you know if that bug has been looked at? Is there a way we are able to check the progress?
Thanks
FYI, these are the pages I have read through that lead me to think there maybe a bug:
https://developers.facebook.com/docs/facebook-login/permissions/v2.0
https://developers.facebook.com/docs/facebook-login/ios/v2.0
I have also notcied in the facebook sample app that ALL of the requests do a “publish_actions” login before doing anything… Why is this the case if initally all we want is read only info? e.g. in the sample app the getInfo_onRelease / GET_USER_INFO request.
From facebook docs:
“Apps should separate the request of read and publish permissions. Plan your app around requesting the bare minimum of read permissions at initial login and then any publish permissions when a person actually needs them , for example when they want to create an Open Graph story from within the app. This provides the best user experience and optimizes conversion.”
Its assigned to an engineer and is in the queue to work on but no more updates.
Rob
Do me a favor and try:
facebook.login( appId, callFacebook, {“email, user_friends”} )
Also try just getting one or the other. I thought I had read somewhere that email and user_friends was included in the basic privs anyway.
Rob
Hi Rob,
Thanks so much for getting back to me… I appreciate my post is a bit on the long side but I wanted to try and show that I’d done the investigation - so thanks for taking the time to read it all!
I have just tried that but it still only gives me the “public profile” (unless I do an initial login first but then im back to two facebook screens)
As a test, I also tried not passing anything in for the permissions and as I expected it still gave me “public profile” since this is the only default permission facebook applies.
i.e. facebook.login( appId, callFacebook, {} )
These are a couple of paragraphs from the facebook docs that seem to back this up:
This is from the “overview section” of https://developers.facebook.com/docs/facebook-login/permissions/v2.0
Permissions are strings that are passed along with a login request or an API call. Here are two examples of permissions:
email - Access to a person’s primary email address.
user_likes - Access to the list of things a person likes.
For example, if you add the login button to a web app and ask for email and user_likes via thescope parameter, a person would be prompted with this dialog when logging in for the first time:
<image removed>
Your app has requested a person’s email address and the things they like but that request also automatically asks for access to a person’s public profile. The full list of permissions, including defaults, is included in this document."
Note the part that I have bolded…
In doing the login you requested:
facebook.login( appId, callFacebook, {“email, user_friends”} )
edited as should be a table: facebook.login( appId, callFacebook, {“email”, “user_friends”} )
should give me these permissions from the get go (i.e. without an initial call to facebook.login)
the automatic “public profile”
the requested “emal”
the requested “user_friends”
But it only give me the automatic one and seems to ignore whatever you pass in as additional permissions. Do you know what happens behind the scenes in the facebook plugin when you first login?
Reading a bit further here: https://developers.facebook.com/docs/facebook-login/permissions/v2.0#reference
It explains which permissions CAN be requested at the initial login:
AND those that CAN’T - i.e do in fact require a second login / request:
(I have just listed the section headings)
I think (hoping? ;) ) there is some confusion in the plugin code around this that can be resolved…
Hope all that makes sense!
Cheers
I just wanted to make sure the syntax is right on the parameter list. I once saw it as { “perm1, perm2” } but that doesn’t make sense because we are passing a table, so ti should be { “perm1”, “perm2” } like you initially had it.
Hi Rob,
yes, I have it as a table - that’s my fault for copying and pasting while doing my post haha
In my actual code I have used a table i.e.
facebook.login( appId, callFacebook, {“email”, “user_friends”} )
I’ve just updated my reply so as not to confuse anyone!
Right, but what I wanted you to do was try it as { “email, user_friends” }, as a single string inside the table and also try it just asking for one of the permissions { “email” } and just humor me and see if it gets you any thing. It should be { “email”, “user_friends” } but because I saw it the other way once, I want to double check it.
Rob
Hi Rob,
I’ve just tried something that was quite interesting…
First thing I tried was a single login with junk data for permissions like so:
function fbLogin(event) -- login to facebook and then get user data fbCommand = GET\_USER\_INFO --facebook.login( appId, fbLogin2, {} ) facebook.login( appId, callFacebook, {"junk1", "morejunk"}) -- {"email", "user\_friends"} ) end
When i ran the above, it just gave me one facebook screen with public_profile permission which I expected…
I then tried the double login process i.e.
local function fbLogin2(event) -- second login?? --facebook.login( appId, callFacebook, {"email", "user\_friends"} ) facebook.login( appId, callFacebook, {"junk1", "morejunk"} ) end function fbLogin(event) -- login to facebook and then get user data fbCommand = GET\_USER\_INFO facebook.login( appId, fbLogin2, {} ) --facebook.login( appId, callFacebook, {"junk1", "morejunk"}) -- {"email", "user\_friends"} ) end
Now when I run the code - I get the same initial facebook page with the public_profile only but when it tried the second login - I get an error on facebook saying “invalid scope: junk1”
I was (a little bit… sorry) hoping for it to error because it suggests that the logic behind facebook.login completely ignores whatever you pass for the permission table whereas second time round it uses it.
Do you think there is a case to delve in to the source code and check?
Ah, sorry Rob - I misunderstood… No worries… happy to try whatever…(I’ll try with a single login request)
Ok, so when I try as a single string I just get the default “public_profile”
Doing just “email” or “user_friends” on its own also just gives me the default “public_profile”
This doesn’t suprise me given my test I did with the “junk” permissions.
Just for fun though… If I do the double login process and I use the single string it does work. I then tried again with a table and that worked too! I correctly get email and user friends permissions displayed on the facebook second login screen
Maybe behind the scenes in the plugin it loops through the table element and appends them to make one string? that could explain why either would work?
Which facebook SDK does corona use in the plugin?
We just updated to the latest plugin about a month ago.
But you can get this working, with two logins correct?
Rob
Yes, using two logins it works but surely we shouldn’t need to do two logins for the read only permissions.
What was the update? is that currently just in the daily builds or is that an update on your end? i.e. will I be using the updated code already?
Facebook is implemented as a plugin for iOS and in the Corona core for Android. That means updates to Facebook for Android happen in daily builds. Since iOS is done via a plugin, it becomes available to everyone when it hits the servers.
I believe the SDK for both iOS and Android are 3.14.1. We had to upgrade to keep up with some breaking changes Facebook was making. They do so about every 3 months.
hi Rob,
Thanks - I should of mentioned from the start that Im just (at the moment) using iOS
In which case, it seems you still have to do a double login for ios? Can this be looked at so it only needs a single login / request?
Were any of the recent changes around the removing the double login process?
After days of struggling i finally have facebook double login and posting to wall working (android).
Putting here so if it helps .
1- Click facebook icon
function postmymsg(event) -- local fbAppID = "XXXXXXXXXX" --replace with your Facebook App ID -- facebook.login( appId, facebookListener, { "user\_friends", "email" } ) fbCommand = POST\_PHOTO facebook.login(appId, callFacebook, {"email", "user\_friends", "publish\_actions"}) end
Note that above I had to also put publish_actions in order to post to wall! (I have email and publish_actions on facebook developer)
2- callFacebook handler
local function callFacebook(event) if ("session" == event.type) then if event.phase ~= "login" then print("not logged in to facebook") return end facebook.login(appid, callFacebook, {"publish\_actions"}) -- This is second login, asks to post to wall if fbCommand == POST\_ABOUT and \_G.fbType == "about" then local postMsg postMsg = { message = " message to send...", name = " name etc.", caption = "stuff", link = "appstorelink", picture = "pictopost" } facebook.request("me/feed", "POST", postMsg) -- sends to wall end end -- callfacebook
I can bring it up to Engineering, but they will want a bug report filed complete with config.lua and build.settings before they will look at this.
Rob