when i use this code in local then it work fine but when i publish it on iis then it's authantication popup terminates

半城伤御伤魂 提交于 2020-01-25 06:59:10

问题


$.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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!