facebook.request("me") gives "OAuthException 2500" on Android

The problem is with facebook’s Android SDK. We provide the Graph API string as-is to facebook’s SDK, but their SDK doesn’t support URL parameters in that string. Instead, they want to receive the parameters separately via an Android “Bundle” object, which is a dictionary/table. This is why our Corona facebook API defines a separate argument for receiving a table of parameters.

I didn’t realize facebook’s iOS SDK supported parameters both ways. That surprised me. [import]uid: 32256 topic_id: 34494 reply_id: 138890[/import]

OK, I finally found the problem with Facebook and Android.

[lua]-- Works on iPhone and Android.
facebook.request(“me”)

– Works on iPhone. Fails on Android.
facebook.request(“me?fields=id,name,first_name,gender”)[/lua]

From what I can understand, adding the “fields” parameter causes the Facebook request to fail on Android.

Then I tried adding the access token manually, and then I got the following error message:

[lua]facebook.request(“me?fields=id,name,first_name,gender&access_token=”…event.token)

– {“message”:“Malformed access token BAAEMi9…?access_token=BAAEMi9…”,
– “type”:“OAuthException”,
– “code”:190}[/lua]

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:

[lua]“me” – becomes “me?access_token=$TOKEN”
“me?fields=id” – becomes “me?fields=id?access_token=$TOKEN”
“me?fields=id&access_token=$TOKEN” – becomes “me?fields=id&access_token=$TOKEN?access_token=$TOKEN”[/lua]

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]

Have you tried this:

local params = {  
 fields = "id,name,first\_name,last\_name,email,username,picture"  
 }  
 facebook.request("me", "GET", params)  

That works for me. [import]uid: 199310 topic_id: 34494 reply_id: 138719[/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]

The problem is with facebook’s Android SDK. We provide the Graph API string as-is to facebook’s SDK, but their SDK doesn’t support URL parameters in that string. Instead, they want to receive the parameters separately via an Android “Bundle” object, which is a dictionary/table. This is why our Corona facebook API defines a separate argument for receiving a table of parameters.

I didn’t realize facebook’s iOS SDK supported parameters both ways. That surprised me. [import]uid: 32256 topic_id: 34494 reply_id: 138890[/import]

olavm, I have the same error.  How did you fix it?

olavm, I have the same error.  How did you fix it?

local params = {
fields = “id,name,first_name,last_name,email,username,picture”
}
facebook.request(“me”, “GET”, params)

This way of getting the fields should be in the doc I think, I was also mislead into trying to do “me/?fields=id,email” instead of the correct way ( at least for android )

Thanks 

local params = {
fields = “id,name,first_name,last_name,email,username,picture”
}
facebook.request(“me”, “GET”, params)

This way of getting the fields should be in the doc I think, I was also mislead into trying to do “me/?fields=id,email” instead of the correct way ( at least for android )

Thanks