Using Facebook Graph to simply post a wall message with just javascript

前端 未结 3 1048
无人及你
无人及你 2020-12-04 06:43

In Facebook how can I post a message onto a user\'s wall saying \"I scored 8/10 on objects game\" then a URL?

I really don\'t want to have to use the full API, as I

3条回答
  •  感动是毒
    2020-12-04 07:29

    Considering that you have a proxy to make cross domain calls, you can simply do this...

    In this example, YourProxyMethod takes a jQuery.ajax like hash, makes a server side post & returns the response in success/error callbacks. Any regular proxy should do.

    The trick is to include app_id and access_token in the URL irself. Also, your FB app should have sufficient permissions to make this call.

    YourProxyMethod({
      url : "https://graph.facebook.com/ID/feed?app_id=APP_ID&access_token=ACCESS_TOKEN",
      method : "post",
      params : {
        message : "message",
        name : "name",
        caption : "caption",
        description  : "desc"
      },
      success : function(response) {
        console.log(response);
      },
      error : function(response) {
        console.log("Error!");
        console.log(response);
      }
    });
    

提交回复
热议问题