AngeloJa3031 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Can not get session for FacebookXmlRestClient. #172

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I'm trying to instantiate FacebookXmlRestClient, and get session by
one-time code generated via url:
http://www.facebook.com/code_gen.php?v=1.0&api_key=YOUR_API_KEY 

I'm using flowing code for this:

FacebookXmlRestClient client = new FacebookXmlRestClient(this.apiKey,
this.secret);
client.setIsDesktop(true);
String session_key = client.auth_getSession(oneTimeCode);
System.out.println("SESSION KEY: " + session_key);

What is the expected output? What do you see instead?
But I'm getting this exception instead of valid session:

com.google.code.facebookapi.FacebookException: Invalid parameter
    at
com.google.code.facebookapi.FacebookXmlRestClient.parseCallResult(FacebookXmlRes
tClient.java:205)
    at
com.google.code.facebookapi.FacebookXmlRestClient.parseCallResult(FacebookXmlRes
tClient.java:67)
    at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:61
2)
    at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:50
8)
    at
com.google.code.facebookapi.FacebookXmlRestClient.auth_getSession(FacebookXmlRes
tClient.java:182)

What version of the product are you using? On what operating system?

I'm using facebook-java-api-2.0.2.jar, on Windows XP.

Please provide any additional information below.

I have authorized my application by myself and grant all additional
permissions to it, but I'm still can't get instance of FacebookXmlRestClient.

How can I instantiate FacebookXmlRestClient for certain user without
calling auth_createToken(), generating URL and prompting him to open
external browser and log in to facebook.

Original issue reported on code.google.com by Ogneb...@gmail.com on 23 Feb 2009 at 12:16

GoogleCodeExporter commented 8 years ago
This is a combination of a few questions and a bug report. Please ask these 
questions
on the facebook api forum.

Please upgrade to version 2.0.5 before posting a bug into the issues list.

Please take a look at the FacebookSessionTestUtils code to see how to 
authenticate a
user given a username and password without asking the user to open a browser. 
We use
Apache HttpClient to simulate the browser interaction.

Also, I'm not familiar with the page http://www.facebook.com/code_gen.php . 
Could you
include in your forum post what you expect it to generate. Thanks.

Original comment by david.j....@googlemail.com on 1 Mar 2009 at 4:47