I want to upload base64 image (jpg,png) on facebook using facebook developers graph API’s in angular 6
‘https://graph.facebook.com/me/photos‘ this api end I am using with passing formdata.
I am referring https://www.devils-heaven.com/facebook-javascript-sdk-photo-upload-from-canvas/
socailpostCall(imageResult) {
let xhr: XMLHttpRequest = new XMLHttpRequest();
let formData = new FormData();
formData.append("access_token",{access_token});
formData.append("source", imageResult);
return this._http.post('https://graph.facebook.com/me/photos',formData)
}
I expect imge should uploaded on facebook as a post, but actually It shows
{
"error": {
"message": "(#200) This endpoint is deprecated since the required permission publish_actions is deprecated",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AckVrByZBvyDeuoac00SVXN"
}
}
2
Answers
The error message tells you that it is not possible anymore to post to a user profile. You can only use this to post to a Page – with a Page Token that includes the
publish_pages
permission.More information: https://developers.facebook.com/docs/graph-api/reference/page/photos/#Creating
When you refer to the docs you can see that the following endpoint has been deprecated
https://developers.facebook.com/docs/graph-api/changelog/4-30-2019-endpoint-deprecations