[lua]facebook.request(“me”)[/lua] works on iPhone, but fails on Android :
[lua]event = {
type = “request”,
name = “fbconnect”,
didComplete = “false”,
isError = “false”,
response = “{“error”:{“message”:“An active access token must be used to query information about the current user.”,“type”:“OAuthException”,“code”:2500}}”,
}[/lua] [import]uid: 73434 topic_id: 34494 reply_id: 334494[/import]
I just tried our facebook sample app which does call [lua]facebook.request(“me”)[/lua]. It worked on my Android device.
The “OAuthException 2500” error indicates that your app has failed to log in and receive a token from facebook. Perhaps your app is making that facebook request too soon? Such as before your Lua listener has received a login success response?
I also suggest that you give our “Networking/Facebook” sample app a go with your app ID and secret key on Android. [import]uid: 32256 topic_id: 34494 reply_id: 137164[/import]
However, all I get from this is Facebook saying on the device screen: “An error occured. Please try later.” The device log gives no error messages. This happened on both iPhone and Android. So I need more help if I am to follow this line.
You wrote, “Perhaps your app is making that facebook request too soon”. So in my own project code, I tried adding a timer before calling facebook.request(“me”), but the error still occurs.
I’m thinking that this must be a configuration issue on your facebook developer page. The vast majority of our facebook related tech-support issues usually are.
Make sure to enable the “Facebook Login” under the Native Android App section to enable SSO (Single Sign-On).
Also, if your Key Hash is wrong (which is the most common tech-support issue we get), then the Android log should tell you what key hash it was expecting. You can copy and paste that to your facebook developer page, which the above blog provides instructions for.
If you also want to support “app requests” and “deep linking”, then you’ll also need to fill out…
Package Name
Class Name (Must be set to “com.ansca.corona.CoronaActivity” without the quotes.)
Canvas URL
Secure Canvas URL
Mobile Web URL
Set Deep Linking to Enabled
[import]uid: 32256 topic_id: 34494 reply_id: 137231[/import]
Our sample app “Network/Facebook” that is included with the Corona SDK definitely works for me. I tried it yesterday with my personal appID using daily build #996.
I hate to ask this question, but are you sure your Android device has Internet access?
Can you access facebook via the official facebook app on your Android device?
Also, I’ve noticed that your app ID has the letters “fb” in front of it. All of the app IDs that I’ve seen from facebook contain only numbers. Perhaps you’ve copy and pasted the wrong ID? Your app ID should be at the top of the “Settings\Basic” facebook developer page. [import]uid: 32256 topic_id: 34494 reply_id: 137240[/import]
Aw! I had [lua]local appId = “fb0123456789”[/lua] rather than just [lua]local appId = “0123456789”[/lua]. Now the sample app works. Then I’ll just have to work out what’s wrong with my original project code. I’ll post my findings here.
PS! Since CFBundleURLSchemes wants “fb0123456789” and facebook.login() wants “0123456789”, you could consider making your API tolerant to Facebook App ID strings both with or without “fb”. Or at least give a warning.
One question.
Does iOS successfully log in with an app ID starting with a “fb”?
Does that “fb” app ID only fail on Android?
(Guess that was 2 questions.)
I ask because I’m an Android developer here (not really set up for iOS) and I wasn’t aware of the “fb” prefix. If iOS accepts the “fb” prefix, then I can modify our Android code to strip it off before handing it over to the Facebook SDK.
[import]uid: 32256 topic_id: 34494 reply_id: 137410[/import]
The “fb” is part of the URL Scheme which is “fb” + “yournumericappid” + “optionalsuffix”.
They are different values and it might cause more confusion to allow you to use the URL Scheme where the specific AppID is needed. [import]uid: 199310 topic_id: 34494 reply_id: 137448[/import]
I just tried our facebook sample app which does call [lua]facebook.request(“me”)[/lua]. It worked on my Android device.
The “OAuthException 2500” error indicates that your app has failed to log in and receive a token from facebook. Perhaps your app is making that facebook request too soon? Such as before your Lua listener has received a login success response?
I also suggest that you give our “Networking/Facebook” sample app a go with your app ID and secret key on Android. [import]uid: 32256 topic_id: 34494 reply_id: 137164[/import]
However, all I get from this is Facebook saying on the device screen: “An error occured. Please try later.” The device log gives no error messages. This happened on both iPhone and Android. So I need more help if I am to follow this line.
You wrote, “Perhaps your app is making that facebook request too soon”. So in my own project code, I tried adding a timer before calling facebook.request(“me”), but the error still occurs.
I’m thinking that this must be a configuration issue on your facebook developer page. The vast majority of our facebook related tech-support issues usually are.
Make sure to enable the “Facebook Login” under the Native Android App section to enable SSO (Single Sign-On).
Also, if your Key Hash is wrong (which is the most common tech-support issue we get), then the Android log should tell you what key hash it was expecting. You can copy and paste that to your facebook developer page, which the above blog provides instructions for.
If you also want to support “app requests” and “deep linking”, then you’ll also need to fill out…
Package Name
Class Name (Must be set to “com.ansca.corona.CoronaActivity” without the quotes.)
Canvas URL
Secure Canvas URL
Mobile Web URL
Set Deep Linking to Enabled
[import]uid: 32256 topic_id: 34494 reply_id: 137231[/import]
Our sample app “Network/Facebook” that is included with the Corona SDK definitely works for me. I tried it yesterday with my personal appID using daily build #996.
I hate to ask this question, but are you sure your Android device has Internet access?
Can you access facebook via the official facebook app on your Android device?
Also, I’ve noticed that your app ID has the letters “fb” in front of it. All of the app IDs that I’ve seen from facebook contain only numbers. Perhaps you’ve copy and pasted the wrong ID? Your app ID should be at the top of the “Settings\Basic” facebook developer page. [import]uid: 32256 topic_id: 34494 reply_id: 137240[/import]
Aw! I had [lua]local appId = “fb0123456789”[/lua] rather than just [lua]local appId = “0123456789”[/lua]. Now the sample app works. Then I’ll just have to work out what’s wrong with my original project code. I’ll post my findings here.
PS! Since CFBundleURLSchemes wants “fb0123456789” and facebook.login() wants “0123456789”, you could consider making your API tolerant to Facebook App ID strings both with or without “fb”. Or at least give a warning.
One question.
Does iOS successfully log in with an app ID starting with a “fb”?
Does that “fb” app ID only fail on Android?
(Guess that was 2 questions.)
I ask because I’m an Android developer here (not really set up for iOS) and I wasn’t aware of the “fb” prefix. If iOS accepts the “fb” prefix, then I can modify our Android code to strip it off before handing it over to the Facebook SDK.
[import]uid: 32256 topic_id: 34494 reply_id: 137410[/import]
The “fb” is part of the URL Scheme which is “fb” + “yournumericappid” + “optionalsuffix”.
They are different values and it might cause more confusion to allow you to use the URL Scheme where the specific AppID is needed. [import]uid: 199310 topic_id: 34494 reply_id: 137448[/import]
Notice that Facebook complains that the access token is $TOKEN?access\_token=$TOKEN. Could this be a revelation of the problem? That Corona somehow makes an error in generating the URL it sends to Facebook? That would explain the initial “2500” error too.
My suspicion is that Corona simply adds access\_token=$TOKEN to the URL prefixed by a ? rather than a &. It makes sense:
I hope someone technical at Corona can take a look at this as soon as possible, as I need to specify the fields parameter. [import]uid: 73434 topic_id: 34494 reply_id: 138715[/import]
I assumed you could indicate full Graph URLs (like me?fields=id) in the path argument. That actually works in iOS, but as we have seen fails on Android with misleading error messages.
Anyway, problem solved on my part.
[import]uid: 73434 topic_id: 34494 reply_id: 138767[/import]