Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Post to Facebook page as owner

$
0
0

So I'm attempting to post to a Facebook page as the owner. I've successfully done this through the Facebook graph api explorer but when I try through my app I always post as a user. (in the posts to page section instead of the feed)

I'm using the Titanium Facebook module

Alloy.Globals.facebook = require('facebook');
I have the page id (How I'm able to post to the page at all) and my message is always coming through perfectly. I use the following permissions:
var advancedPermissions = ["basic_info", "publish_actions", "manage_pages"];
I retrieve the access_token with:
Alloy.Globals.facebook.reauthorize = advancedPermissions;
Alloy.Globals.facebook.requestWithGraphPath("me/accounts", {} ,'GET', function(e) {
    Ti.API.info("Request Sent");
    if (e.success) {
        var responseContent = JSON.parse(e.result);
        for(var i = 0; i < responseContent.data.length; i++){
            if(responseContent.data[i].id == pageID){ //facebookAccount is actually the page id
                token = responseContent.data[i].access_token;
                break;
            }
        }
    }else if(e.error){
        alert(e);
    }
});
And I am getting a token out of this, and this token is valid (passing an invalid one would throw an error).

So I call:

Alloy.Globals.facebook.reauthorize = advancedPermissions;
Alloy.Globals.facebook.requestWithGraphPath(pageID + '/feed', {access_token:token, message:comment}, 'POST', function(e) {...}

It returns a success and looks exactly like it would if it has posted on the feed, but it won't. Can anyone see my obvious error or know the trick to get this to work in the Facebook module?

Titanium SDK: 3.5.0.GA

facebook: 3.2.0 (latest)


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>