AngeloJa3031 / facebook-java-api

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

Incorrect Signature with API 3.0.4 #365

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, I know that this theme isn´t a new one, but I need help and no answer 
could help me...

I want connect to facebook and download the posts from my page. To do this, I 
try to get the stream content. But when I want to get the Stream, I get the 
error "Incorrect Signature".

My Facebook App ist set to Desktop Mode.

PLEASE HELP ME

My Code:

public class FBConnection {    

 List<Comment> comments;

 public void getData(String id) throws FacebookException{

   String API_KEY = "372974076106297";
   String SECRET = id;

  // Create the client instance

    FacebookJsonRestClient client = new FacebookJsonRestClient(API_KEY, SECRET);

 try {
 String token = client.auth_createToken();
 // Build the authentication URL for the user to fill out

 String url = "http://www.facebook.com/login.php?api_key=" 

                        + API_KEY + "&v=1.0" 

                        + "&auth_token=" + token;

 // Open an external browser to login to your application
 String browserPath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
              String[] browserarray = {browserPath, url};

 Runtime.getRuntime().exec(browserarray);

    // Wait until the login process is completed

    System.out.println("Use browser to login then press return");
    System.in.read();

    // fetch session key
    String session = client.auth_getSession(token, true);
    // String sessionSecret = client.getSessionSecret();
    String cacheSessionKey = client.getCacheSessionKey();

    // new facebook client object
    FacebookJsonRestClient facebook = new FacebookJsonRestClient(API_KEY, session, cacheSessionKey);

    Long userID = client.users_getLoggedInUser();

    JSONObject stream_get = facebook.stream_get(userID, null, null, null, null, null, null);

    for (Comment comment : comments) {
                           System.out.println(comment.getText());
        }
      }
   catch (FacebookException e) {

   // TODO Auto-generated catch block
                                  System.out.println("Catch-Bloc-FB1");
         e.printStackTrace();

} catch (IOException e) {

 // TODO Auto-generated catch block
                            System.out.println("Catch-Bloc-FB2");
  e.printStackTrace();

  }

} 
            public List<Comment> getComments() {
                return comments;
                }
            }

Original issue reported on code.google.com by c.stefan...@googlemail.com on 25 Aug 2012 at 7:01