Question

I m trying simple program to update FB status, but its giving me error, This is what i m trying ...

public class SendtoFacebook {

public static void main(String a[]) throws FacebookException {

    SendtoFacebook sfb = new SendtoFacebook();
    sfb.send("From My App: Rohan's App");
}

public void send(String message) throws FacebookException {

    String FB_APP_API_KEY = new String("461632878708096");
    String FB_APP_SECRET = new String("5513aa2b99879879897ff0fa5a7a");
    String FB_SESSION_KEY = "";
    FacebookJsonRestClient facebook = new FacebookJsonRestClient(FB_APP_API_KEY, FB_APP_SECRET);

    //FacebookJsonRestClient facebookClient2 = (FacebookJsonRestClient)facebook.getFacebookRestClient();
    FacebookJsonRestClient facebookClient = (FacebookJsonRestClient) facebook;
    facebookClient.stream_publish(message, null, null, null, null);

    System.out.println("successfully updated");

}

}

And m getting this error_ Exception in thread "main" com.google.code.facebookapi.FacebookException: parameters uid or session key required at com.google.code.facebookapi.JsonHelper.parseCallResult(JsonHelper.java:59) at com.google.code.facebookapi.ExtensibleClient.extractString(ExtensibleClient.java:2296) at com.google.code.facebookapi.ExtensibleClient.stream_publish(ExtensibleClient.java:2150) at com.google.code.facebookapi.SpecificReturnTypeAdapter.stream_publish(SpecificReturnTypeAdapter.java:503) at socialdemo.SendtoFacebook.send(SendtoFacebook.java:31) at socialdemo.SendtoFacebook.main(SendtoFacebook.java:19)

Is any buddy knw about this? plz.. n thanx.

Was it helpful?

Solution

Facebook APIs require the session key. When I need such a key, I go to this link, click on "Get Access Token", select the required authentications from the lists, and use the generated session key in my program. It expires after a day or so, in which case I re-generate one.

Hope that helps.

Regards,

Salil

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top