You can do this by calling FB.api method once you get the response object after authentication. Note that you need to get publish_actions
permission in order to make publishing API calls. So, your final code must look something like:
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me/feed', 'post', {message: 'I signed up for the service X!'});
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'publish_actions'});
You can find more information on this in the following documents: