Advertisement
Guest User

Untitled

a guest
Oct 17th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on start:
  2.  
  3. window.fbAsyncInit = function () {
  4.     FB.init({
  5.       appId: FB_APP_ID,
  6.       status: true,
  7.       cookie: true,
  8.       oauth: true,
  9.       xfbml: true
  10.     });
  11.     FB.Event.subscribe("auth.login", function (a) {
  12.         uid = a.authResponse.userID;
  13.       accessToken = a.authResponse.accessToken;
  14.     });
  15.     FB.getLoginStatus(function (a) {
  16.       if (a.status === "connected") {
  17.         uid = a.authResponse.userID;
  18.         accessToken = a.authResponse.accessToken;
  19.        
  20.         fb_loginok()
  21.       }
  22.     });
  23.   };
  24.  
  25.   (function (a) {
  26.     var b, c = "facebook-jssdk";
  27.     if (a.getElementById(c)) {
  28.       return
  29.     }
  30.     b = a.createElement("script");
  31.     b.id = c;
  32.     b.async = true;
  33.     b.src = "//connect.facebook.net/en_US/all.js";
  34.     a.getElementsByTagName("head")[0].appendChild(b)
  35.   })(document);
  36.  
  37. to make the post i use:
  38.  
  39. FB.api("/" + FB_PAGE_ID + "/feed", "post", {
  40.     message: "test"
  41.  }, function (a, b, c) {
  42.    if (!a || a.error) {} else {
  43.      dosomething();
  44.    }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement