简体   繁体   English

离子 4 发布到 Facebook 页面

[英]Ionic 4 Post to Facebook Page

I would like to post a message that the user creates from within my app to a facebook page that I own我想将用户从我的应用程序中创建的消息发布到我拥有的 facebook 页面

I have set up facebook login on my app already, I would just like to know how I can use the graph api in my app to post on my facebook page我已经在我的应用程序上设置了 facebook 登录,我想知道如何在我的应用程序中使用图表 api 在我的 facebook 页面上发布

here is the link to the IONIC Cordova Facebook Plugin Repo: https://github.com/jeduan/cordova-plugin-facebook4 So something like this should work:这是 IONIC Cordova Facebook 插件回购的链接: https://github.com/jeduan/cordova-plugin-facebook4

this.facebook.api("/114987089875646/feed", ["manage_pages","publish_pages"])

But it does not work because the api method only creates GET requests and there is no way to set the request method to POST但它不起作用,因为 api 方法只创建 GET 请求,没有办法将请求方法设置为 POST

Also the cordova's Facebook plugin also doesn't seem like it supports posting to Graph API.此外,cordova 的 Facebook 插件似乎也不支持发布到 Graph API。

Why you dont use the angular http to make your request?为什么您不使用 angular http 提出您的要求?

https://angular.io/guide/http https://angular.io/guide/http

like this:像这样:

this.http.post('https://graph.facebook.com/{your-page-id}/feed?message=Awesome!&access_token={your-page-access-token}', { data }, { headers }).map(res => res.json());

request url find here:https://developers.facebook.com/docs/graph-api/using-graph-api/请求 url 在这里找到:https://developers.facebook.com/docs/graph-api/using-graph-api/

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

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