问题
$.ajax({
url: '@Url.Action("LinkedINAuth", "Vacancy")',
data: {
vacancyIds: Array.toString()
},
async: true,
type: 'POST',
cache: false,
success: function(datas) {
var html = datas.split(',')[0].toString();
var image = datas.split(',')[1].toString();
//txp2rKYpuKZXaaYC5kB-m13KnVE Initialize with your OAuth.io app public key
OAuth.initialize('txp2rKYpuKZXaaYC5kB-m13KnVE');
// $('#auth').show();
OAuth.popup('linkedin2').then(linkedin => {
console.log('linkedin:', linkedin);
// Get your linkedin profile id:
linkedin.me().then(data => {
let id = data.id;
linkedin.post({
url: "/v2/shares",
data: JSON.stringify({
"content": {
"contentEntities": [{
"description": "We are hiring Deserving candidate for Dubai Location",
"entityLocation": html,"thumbnails": [{
"imageSpecificContent":{
"size":141287,
"width":644,
"height":411
},
"resolvedUrl": image
}]
}],
"title": "Current Hiring"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": `urn:li:person:${id}`,
"subject": "Current Hiring",
"text": {
"text": "Current Hiring!"
}
}),
headers: {
"x-li-format": "json",
"X-Restli-Protocol-Version": "2.0.0",
"Content-Type": "application/json"
}}).then(data => {
console.log("success:", data);
}).fail(err => {
console.log("err:", err)
});
});
});
}});
来源:https://stackoverflow.com/questions/58831292/when-i-use-this-code-in-local-then-it-work-fine-but-when-i-publish-it-on-iis-the