我在获取公司更新时遇到问题,但是我的代码在 Linkedin上的testDevCo之后“ var cpnyID = 2414183; // LinkedIn的testDevCo
所以我的问题是我是要提取的公司的管理员 我的更新,但为什么会出现以下错误?
{
"errorCode": 0,
"message": "Unknown authentication scheme",
"requestId": "MRJ33C5FVX",
"status": 401,
"timestamp": 1540989274268
}
Code:
<script type="text/javascript" src="https://platform.linkedin.com/in.js">
api_key: 8616po0krrhh2k
onLoad: onLinkedInLoad, onLinkedInAuth
</script>
<div id="displayUpdates"></div>
<script type="text/javascript">
function onLinkedInLoad() {
IN.Event.on(IN, "auth", onLinkedInAuth);
console.log("On auth");
}
function onLinkedInAuth() {
var cpnyID = 86104; //the Company ID for which we want updates
IN.API.Raw("/companies/" + cpnyID + "/updates?event-type=status-update&start=0&count=3&format=json").method("Get").result(displayCompanyUpdates)
console.log("After auth");
}
function displayCompanyUpdates(result) {
var div = document.getElementById("displayUpdates");
var el = "<ul>";
var resValues = result.values;
for (var i in resValues) {
var share = resValues[i].updateContent.companyStatusUpdate.share;
var isContent = share.content;
var isTitled = isContent,
isLinked = isContent,
isDescription = isContent,
isThumbnail = isContent,
isComment = isContent;
if (isTitled) {
var title = isContent.title;
} else {
var title = "News headline";
}
var comment = share.comment;
if (isLinked) {
var link = isContent.shortenedUrl;
} else {
var link = "#";
}
if (isDescription) {
var description = isContent.description;
} else {
var description = "No description";
}
/*
if (isThumbnailz) {
var thumbnailUrl = isContent.thumbnailUrl;
} else {
var thumbnailUrl = "http://placehold.it/60x60";
}
*/
if (share) {
var content = "<a target='_blank' href=" + link + ">" + comment + "</a><br>";
//el += "<li><img src='" + thumbnailUrl + "' alt=''>" + content + "</li>";
el += "<li><div>" + content + "</div></li>";
}
console.log(share);
}
el += "</ul>";
document.getElementById("displayUpdates").innerHTML = el;
}
</script>
答案 0 :(得分:0)
您可以做/检查的几件事: