authentication - Invalid parameter exception on client.auth_getSession() in Facebook java API -


I want to connect with your Facebook app using Facebook Java API 2.1.1 (). My application is in "Desktop" mode so I should be able to reach it out of the web application. I have not defined any callback URL for my code looks like this:

  FacebookJsonRestClient client = new FacebookJsonRestClient (FB_APP_API_KEY, FB_APP_SECRET). String token = client.auth_createToken (); Http client http = new HTTP client (); Http.SsetParams (new HTTP client) (); Http .setState (new HTTPSTATE); Last string login = "https://login.facebook.com/login.php"; Get GetMethod = new GetMethod (LOGIN + + FB_APP_API_KEY + "api_key =?" "& Amp; V = 1.0 & amp; auth_token =" + tokens); Http.executeMethod (found); Postmap post = new postmount; Post.addParameter (new name ValuePair ("api_key", FB_APP_API_KEY)); Post.addParameter (new name ValuePair ("v", "1.0")); Post.addParameter (new name ValuePair ("auth_token", token)); Post.addParameter (New Name ValuePair ("Email", "My-Email")); Post.addParameter (New Name ValuePair ("pass", "my-password")); Http.executeMethod (post); String session = client.auth_get session (token);  

However, instead of Session API to return throws an exception:

  com.google.code.facebookapi.FacebookException: Invalid parameter com.google. code.facebookapi.FacebookJsonRestClient.parseCallResult (FacebookJsonRestClient.java:354) com.google.code.facebookapi.ExtensibleClient.callMethod (ExtensibleClient.java:535) on com.google.code.facebookapi.ExtensibleClient.callMethod (on ExtensibleClient.java: 472) com.google.code.facebookapi.FacebookJsonRestClient.auth_getSession (on FacebookJsonRestClient.java:278)  

can anyone tell me what is wrong with this code?

Thank you for your help.

Regards Nabell Mokshar

As far as I understand the FBI API, you do not need to enter the user name and password manually but instead it will be used as a user manually Input from them and then allow Facebook login to get the user back in their application. This means that instead of providing "email" and "pass" you provide "next" and "cancel" url. Instead s

This is purely a security feature of the FB API and as long as the principle behind it is okay, performance is far from optimal.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -