使用rest api来自linkedin的错误响应

时间:2018-09-03 08:19:04

标签: angular ionic2 linkedin mean-stack linkedin-api

我正在尝试使用rest API方法实现登录LinkedIn功能。我已经从LinkedIn获得了access_tokenexpires_in。我从中提取了access_token并传递给get请求以获取个人资料详细信息。但是我没有得到任何回应。这是我的代码。

gettheLinkedinUserDetails(token: any) {

alert(token);

let headers = new HttpHeaders();

//headers.append('Content-Type', 'application/x-www-form-urlencoded');

headers.append('Authorization','Bearer '+token);

return this.http.get('https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url)?format=json',{headers: headers})

} 

this.lkPage.gettheLinkedinUserDetails(result)
            .subscribe((profileData: any) => {
              alert(profileData + 'profile');
            },(err) => {
              alert(err + 'error');
            })

&在响应中,我得到的错误为 {"headers":{"nomalizedNames":{},"lazyUpdate":null},"status":401,"stsusText":"OK","url":"https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url?format=json" ","ok":false,"name":"httpErrorResponse""message":"Http failure response forhttps://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url)?format=json;401 OK","error ":{"errorCode":0,"message":"Unknown authentication schema","requestId":"B6AFJPFBMX","status":401 "timestamp":1535978521964}}

0 个答案:

没有答案