I am trying to post a Share to LinkedIn using OAuth v2 - I have got authorisation correctly and have the appropriate access keys. This code is supposed to share a link on LinkedIn, but for some reason it's not working - I'm not sure why. Can anyone help? this is my request body:
{
  "distribution": {
      "linkedInDistributionTarget": {}
  },
  "owner": "urn:li:person:XXXXXX",
  "subject": "Test Share Subject",
  "text": {
      "text": "Hello !"
  }
And this my call API shares :
  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 get this issue:
I've already installed the Moesif CORS and it didn't worked
I fixed the error using this post.. it should use REST API from the backend and not from frontend
 
    