When trying to login, the web based login window is shown although I have the latest Facebook app installed.
Corona build 2299
iPhone 4 iOS 7.1.1
Facebook 9.0.0.25.31
When trying to login, the web based login window is shown although I have the latest Facebook app installed.
Corona build 2299
iPhone 4 iOS 7.1.1
Facebook 9.0.0.25.31
What are your facebook App settings?
Rob,
on what settings do you refer?
Single Signon
Deep linking on the basic tab
All the settings on the Advanced tab, etc.
Here they are.
Is there something wrong?
And I tried with the newest daily build (2303) but same result…
On my test app, I have on the “Advanced Tab”
Native or desktop app? == YES
Is your App Secret embedded? == NO
Client OAuth Login == YES
Embedded browser OAuth Login == YES
The other two underneath that I have as “NO”.
If you are not a Native App then it thinks you’re a web app.
Rob
To clarify. On your developer page on facebook you must set type of application. It must be mobile or web. If you have web selected then always web popup will be opened.
Thank you guys for trying to help but what you suggested didn’t helped.
In fact I was pretty sure that will not help. Why?
In our game “Ultimate BlackJack Reloaded” (and some others) which is live for some time, I never changed anything on the Advanced tab (and the default for “Native or desktop app” is NO) and, surprise, surprise everything was working as it should.
Just downloaded the game again from App Store to check if it still works and yes, it does.
So the latest changes from Facebook and Corona broke a lot of things. One of those is this.
I am a big fan of Corona but the way you handled the facebook change to V2 is not something you can be proud of.
There was no transparency which FB version you call in which version or plugin and I am yet not sure which one is used for iOS.
Have to say I am not noob regarding development nor FB implementation (implemented in several games)…
@ubj3d: I’m not 100% sure this will fix things, but please give it a try and let me know. I experienced a similar issue briefly after the switch to Graph 2.0, and I managed to get it fixed, but I was troubleshooting a number of issues at the time so I can’t say for sure that this is what fixed the web-login issue.
When you call Facebook.login, are you requesting advanced permissions? If so, Facebook now requires you to make 2 distinct login calls. The first one is a general login call, and cannot request any advanced permissions. Then after a successful login with no permissions requested, make a second login call with your required permissions (“read_stream”, “publish_actions”, etc…). In my experience a week or two ago, when I tried to use a single login call (which worked prior to Graph 2.0), I saw the web-based login. Here is a sample of what the new dual-login call could look like:
local function facebookLogin() local function facebookListener2( event ) -- THIS IS WHERE YOU'D MAKE YOUR FACEBOOK.REQUEST CALLS... end local function facebookListener1( event ) if ( "session" == event.type ) then if ( "login" == event.phase ) then timer.performWithDelay(500, function() facebook.login( facebookAppID, facebookListener2, {"read\_stream", "publish\_actions"} ) end) else native.showAlert( "Facebook Login Fail", "Sorry, but we encountered an issue logging in to Facebook. Please check your internet connection and try again.", {"OK"} ) end end end facebook.login( facebookAppID, facebookListener1 ) end facebookLogin()
Note that I delayed the second FB login call by half a second using timer.performWithDelay() - this is just me playing it safe. I find making login calls too close together can sometimes create unwanted results. Your mileage may vary, and you may want to remove that delay in your own implementation.
Again, I’m not 100% sure this will fix things, but regardless it’s something you should do if you’re not already. And in Corona Labs’ defense, this is a change that Facebook made with very little documentation to make it clear to developers that they’d need to radically change how they log in using the Graph API. That said, it might be something that Corona Labs could add to their own API docs to try and make clear - OR modify the facebook.login to automatically make separate login calls if the Lua code contains a permissions table.
Please let me know if this helps. Good luck - I know first-hand how frustrating these Facebook API changes can be!
Damir, you really can’t compare the behavior of older apps compiled against old SDKs. If every facebook change broke apps already in the store, there wouldn’t be any possible way any app could stay in business and there would have to be constant updates.
Please try it with the settings I suggested and see what the behavior is.
Rob
I tried the old version just to be sure FB did not broke anything. Sorry if it isn’t clear from my last post, I DID try what you suggested and it didn’t helped.
And I will ask again and again till I don’t get the answer:
What Facebook API version is called in the iOS facebook plugin ?
Thank you very much for trying to help.
At the first user login we do not ask for any extended permissions (just getting, the name and the id)…
Here is my login code (it is a bit more complicated because we are also logging into parse after FB):
function parseFacebookLogin(fnc1, fnc2) local sessionToken, sessionExpiry local function doParseLogin( fb\_user\_id, fb\_session\_token, fb\_session\_expiry ) local authData = { ["facebook"] = { ["id"] = tostring( fb\_user\_id ), ["access\_token"] = tostring( fb\_session\_token ), ["expiration\_date"] = parse:timestampToISODate( fb\_session\_expiry ) } } local function onLoginUser( event ) if(event.error == nil) then if(fnc1~=nil) then me.id = event.response.objectId me.country = event.response.country fnc1() end else if(fnc2~=nil) then fnc2(tostring(event.error)) end end end parse:loginUser( { authData = authData }, onLoginUser ) end local function doFacebookLogin() local function facebookListener( event ) if event.type == "session" then if event.phase == "login" then sessionToken = event.token sessionExpiry = event.expiration local params = {fields = "id,name"} if sessionToken then facebook.request("me", "GET", params) else if(fnc2~=nil) then fnc2("error3") end end elseif(event.phase == "loginFailed" ) then if(fnc2~=nil) then fnc2("Login failed.") end elseif(event.phase == "loginCancelled" ) then removeLoading() end elseif event.type == "request" then if not event.isError then local response = json.decode( event.response ) if response.id then local fb\_user\_id = response.id me.fbID = fb\_user\_id if(response.name==nil) then me.username = me.fbID else me.username = response.name end me.loginMethod = 2 --all set, lets create/login Parse User doParseLogin( fb\_user\_id, sessionToken, sessionExpiry ) end else if(fnc2~=nil) then fnc2(event.response) end end end end facebook.login(FB\_ID, facebookListener,{ "public\_profile" }) end doFacebookLogin(fnc1, fnc2) end
Regards,
Damir.
Hi Damir,
I’ll see if I can replicate the web-login issue and isolate a fix. Like I said, I experienced that same issue, but got it fixed while I was working out other bugs, so I’m not sure exactly what fixed it. If I can find a solution, I’ll post it here.
As to your question of which Facebook API is called from your app, unless I’m mistaken, that is determined on the Facebook side and not the Corona side. Basically, if your Facebook app ID was created prior to April 30, 2104, then you have the ability to make FB Graph 1.0 calls - but only until Graph 1.0 expires next year. See the below, taken from https://developers.facebook.com/docs/apps/versions:
Can my app make calls to versions older than the current version?
An app can make calls to versions of the API that were current when the app was created. This means if your app was created when v1.0 was available, then it can make calls to v1.0 until v1.0 expires. If your app was created after v2.0 was released, it won’t be able to make calls to v1.0. In addition, apps that were created on older API versions but haven’t been used won’t be able to use older API versions. This will hold true for all future API version releases.
When you use the facebook.request() API, if your Facebook App ID was generated prior to April 30th, then I believe it is an “unversioned” API call (if your app ID was created after April 30th then it is always 2.0) - but you can specify graph 1.0 by modifying your Facebook.request call as such:
-- OLD (UNVERSIONED) WAY OF MAKING A FACEBOOK.REQUEST CALL: facebook.request("me", "GET", params) -- NEW WAY OF MAKING A FACEBOOK.REQUEST CALL, SPECIFYING API V1.0: facebook.request("v1.0/me", "GET", params) -- NEW WAY OF MAKING A FACEBOOK.REQUEST CALL, SPECIFYING API V2.0: facebook.request("v2.0/me", "GET", params)
I’ll let Rob correct me if he thinks I’m wrong, but I’m pretty sure this is the answer to your question: the Facebook.request() Corona API will make an unversioned call to the Graph API unless you specify a version as above - and you can only specify version 1.0 if your Facebook App ID was created prior to the rollout of Graph 2.0. So if you have a specific need to use Graph 1.0 (for example, if you utilize public post searching, which was deprecated in version 2.0), then you’d want to specify v1.0 in your Facebook.request() call.
Hope this helps - I know that integrating Facebook can be maddening, but honestly I feel that most of the blame is on Facebook’s shoulders here - the folks at Corona Labs are in the same boat as the rest of us, having to react to whatever changes Facebook decides to implement on a whim…
Good luck! I’ll report back if I can find a fix for the web-login issue…
Hi Jason,
once again your help is very much appreciated.
The call you suggested (facebook.request(" v2.0 /me", “GET”, params)) DID help to login to iOS!
The info you posted will help many developers I am sure.
Now there is this “web-login” issue left…
Regards,
Damir.
Engineering said that it will do v2.0 calls.
But it seems you’re seeing different behavior.
Rob
Just to verify, the web login issue is on Android, not iOS. Are you using the latest daily build?
Thanks
Rob
No, Android is fine.
The problem is on iOS.
I’m seeing the same problem in the Facebook sample app. I’ve opened a bug report #32908.
Rob
Thank you Rob, much appreciated.
Regards,
Damir.
Corona Labs,
is the bug fix for this coming soon?
Regards,
Damir.