Reputation: 9818
I am trying to setup my app, so the user can login to facebook and i can then upload a post for them, simple.
I have this code
// let the user login
FB.login(function(response) {
if (response.authResponse) {
alert(JSON.stringify(response.authResponse));
// post to facebook
// create our facebook data object
var data = {
access_token: response.authResponse.accessToken,
message: "Upload this post to facebook"
};
// success, now upload the rest of the post, text etc
FB.api('/me/feed', 'post', data, function(response) {
if (!response || response.error) {
alert("There was an error uploading your post to facebook: " + response
.error.message);
} else {
alert("error: " + JSON.stringify(response));
}
});
} else {
alert(
'There was an error logging you in to facebook, or you did not authorize the app to post on your wall'
);
}
}, {
scope: 'publish_stream'
});
Since this is a cordova app, i have this in my device ready event
// initialize facebook
FB.init({
appId: "123456789", // facebook appId
nativeInterface: CDV.FB,
useCachedDialogs: false
});
Now as you can see, i am asking for the permission "publish_stream" which i believe is correct, but i keep getting a message when attempting to post, saying
There was an error uploading your post to facebook (#200). The user hasn't authorizard the application to perform this request
Well i quite clearly have.
I have this on another application that i created nearly a year ago and it all seems to work fine.
One thing i have read about is that "publish_stream" or "publish_actions" is now not available when you login, unless you submit your app for review? is this only for new apps created, as i havent done this with my other app, but it seems to work. This app also shows a message after you login, shown here. I am sure my other app doesnt show this
EDIT: I have checked my other app and it doesnt show the above message. here is a screenshot
Any help would be appreicated.
Upvotes: 0
Views: 496
Reputation: 73984
publish_stream
is deprecated, use publish_actions
Btw, you are not allowed to prefill the message parameter, it always has to be 100% user generated. And don´t "autopost" right after login (or ever). That´s against the rules too. Check out the platform policy for more information: https://developers.facebook.com/policy/
Upvotes: 1