Skip to content

Instantly share code, notes, and snippets.

@leonelquinteros
Created February 20, 2014 20:12
Show Gist options
  • Save leonelquinteros/9122235 to your computer and use it in GitHub Desktop.
Save leonelquinteros/9122235 to your computer and use it in GitHub Desktop.
FB publish
<div id="fb-root"></div>
<script>
// Load the SDK Asynchronously
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>
function fbPublish() {
FB.init({
appId: 1463979287150093,
});
FB.login( function(response) {
if(response && response.status == 'connected' && response.authResponse.accessToken) {
FB.api('me/feed', 'post', {message: 'Hello World'});
}
}, {scope: 'publish_actions'});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment