如何解决使用Share API v2发布到LinkedIn的HTTP响应错误
我正在尝试使用OAuth v2将共享发布到LinkedIn-我已正确获得授权并具有适当的访问密钥。 该代码应该在LinkedIn上共享一个链接,但是由于某些原因,它无法正常工作-我不确定为什么。有人可以帮忙吗? 这是我的请求正文:
{
"distribution": {
"linkedInDistributionTarget": {}
},"owner": "urn:li:person:XXXXXX","subject": "Test Share Subject","text": {
"text": "Hello !"
}
这与我的呼叫API共享:
publishPostLink(body : any,token : any){
this.headers = new HttpHeaders(
{
'Content-Type': 'application/json','Authorization':'Bearer '+token,'cache-control': 'no-cache','X-Restli-Protocol-Version':'2.0.0',});
return this.http.post("https://api.linkedin.com/v2/shares",body,{headers: this.headers});}
我遇到了这个问题:
I've already installed the Moesif CORS and it didn't worked
我通过这篇文章修正了错误。 it should use REST API from the backend and not from frontend
解决方法
http:// localhost是不安全的请求来源,因此在许多情况下不支持它。 尝试使用Ngork https://ngrok.com/
之类的隧道软件版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。