I've found the solution, I had to save the Facebook token and then retrieve it from a view model.
FB.init({
appId: APPID,
authResponse: {
accessToken: '@Model.FacebookToken'
}
});
after this, I had to check if the permission existed; if not, then I request them again like this:
var checkPermissions = function () {
FB.api('/me/permissions', function (response) {
var perms = response.data[0];
// Check for publish_stream permission
if (perms.publish_stream) {
console.log('User has permission')
} else {
FB.login(function (response) {
// Request permission
}, { scope: 'publish_actions' });
}
});
};