Take the 2-minute tour ×

I am trying to communicate with Facebook doing simple things. At the moment I can log a user in and post to their wall as them. But for whatever reason, I can't seem to access public information such as their name. I consistently get this error:

{"error":{"message":"Syntax error \"Expected end of string instead of \"?\".\" at character 4: name?access_token=MYACCESSTOKEN","type":"OAuthException","code":2500}}

Here is the call:

SampleRequestListener srl = new SampleRequestListener();
AsyncFacebookRunner afr = new AsyncFacebookRunner(facebook);
afr.request("http://graph.facebook.com/me?fields=name", (RequestListener)srl);

That call is made within a validated session (in the onComplete portion of the DialogListener for .Authorize). Using my access_token and the exact same string as above I can get the request to work just fine at http://developers.facebook.com/tools/explorer/

The error occurs whilst parsing the response in the RequestListener.onComplete

JSONObject json = Util.parseJson(response);
final String name = json.getString("name");
System.out.println("Hi, my name is " + name);

Thank you for your time. All input is welcomed.


There are two things going on. In the facebook API, Util.openUrl was appending a "?" between the field name and the access_token (as the answer below pointed out). This seems odd. I wonder if I pulled an old version of the API or something. You would think that would be set up correctly.

Also, I called the method incorrectly: This:


Should be:

afr.request("me?fields=name", (RequestListener)srl);
share|improve this question
Can you help me solve my issue stackoverflow.com/q/17102992/1767260. I think it is similar to your problem.But I cann't figure out the issue in my code.Can you check –  user1767260 Jun 17 '13 at 9:04

2 Answers 2

up vote 1 down vote accepted

Looks like the actual request being sent is something like


and that of course is wrong; it should be an ampersand before the second parameter and not a question mark.

You’d have to look for the location in the code where the access token is added as parameter. At that point there should be a check for whether this URL already contains a question mark or not before appending the access_token parameter.

share|improve this answer
Huh. This seems odd... The "?" is being added in the Facebook API Util.openUrl method. Is that really a thing I should be modifying? I gave it a shot and now the error is: com.facebook.android.FacebookError: (#100) Unknown fields: name –  Ezekiel Buchheit Jul 16 '12 at 20:42

If you are using com.facebook.Request class then just use the following form of constructor: Request(Session session, String graphPath, Bundle parameters, HttpMethod httpMethod, Callback callback) and pass your parameters in "parameters" parameter.

share|improve this answer

Your Answer


