-1

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"
   }
}
Pravin_Patil
  • 3
  • 1
  • 4

2 Answers2

1

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

andyrandy
  • 72,880
  • 8
  • 113
  • 130
0

When you refer to the docs you can see that the following endpoint has been deprecated

Apps that have used these endpoints in the last 90 days (before 30th april) can continue using them with API versions 3.2 and lower until July 30th, 2019.

https://developers.facebook.com/docs/graph-api/changelog/4-30-2019-endpoint-deprecations

Krzysztof Krzeszewski
  • 5,912
  • 2
  • 17
  • 30
  • Thanks @luschn, but I want to post the image on my personal profile, not on the page...,So is it possible? – Pravin_Patil Jul 29 '19 at 09:46
  • i guess you posted this at the wrong answer - as you can read in my answer, posting to your personal profile ist not possible anymore. – andyrandy Jul 29 '19 at 10:02