How to post user status on facebook?

Asked

Viewed 139 times

2

I made an app on facebook and took the app_secret I finally got everything, the goal is for the user to publish in his own timeline however, I can even publish but only in my app and with the login of the app, when I run the application with another user until loga but not put to msg, I’m using facebook4j, the question is is there any configuration to do in the graph api beyond the standard or I have to change the code below?

Facebook facebook = new FacebookFactory().getInstance();
    facebook.setOAuthAppId("MEU ID", "MEU APP_SECRET");
    try {

        facebook.getOAuthAccessToken("O MEU TOKEN DA APLICAÇÃO");

    } catch (FacebookException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    facebook.setOAuthPermissions("email,publish_actions");          
    ConfigurationBuilder confBuilder = new ConfigurationBuilder();
    confBuilder.setDebugEnabled(true);
    confBuilder.setJSONStoreEnabled(true);

    confBuilder.build();

    request.getSession().setAttribute("facebook", facebook);

    StringBuffer callbackURL = request.getRequestURL();
    int index = callbackURL.lastIndexOf("/");
    callbackURL.replace(index, callbackURL.length(), "").append("/callback");
    response.sendRedirect(facebook.getOAuthAuthorizationURL(callbackURL.toString()));
}
  • Hi, Marcos, welcome to the site. Please try to format the question correctly and give a descriptive title. You can [Edit] to fix things (link right below the tags).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.