简体   繁体   English

使用GraphAPI将Base64图片上传为Facebook上的帖子

[英]Upload Base64 image as post on facebook using GraphAPI

I want to upload base64 image (jpg,png) on facebook using facebook developers graph API's in angular 6 我想使用angular 6中的facebook开发人员图API在facebook上上传base64图像(jpg,png)

' https://graph.facebook.com/me/photos ' this api end I am using with passing formdata. ' https://graph.facebook.com/me/photos '我正在使用此api传递表单数据。 I am referring https://www.devils-heaven.com/facebook-javascript-sdk-photo-upload-from-canvas/ 我指的是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 我希望imge应该作为帖子上传到Facebook,但实际上它显示

{
   "error": {
      "message": "(#200) This endpoint is deprecated since the required permission publish_actions is deprecated",
      "type": "OAuthException",
      "code": 200,
      "fbtrace_id": "AckVrByZBvyDeuoac00SVXN"
   }
}

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. 您只能使用它来发布到页面-具有包含publish_pages权限的页面令牌。

More information: https://developers.facebook.com/docs/graph-api/reference/page/photos/#Creating 更多信息: 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 当您参考文档时,您可以看到以下端点已被弃用

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. 在过去90天内(4月30日之前)使用这些终结点的应用程序可以继续使用API​​版本3.2和更低版本的终结点,直到2019年7月30日。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM