简体   繁体   English

linkedin和onLinkedInLoad

[英]linkedin and onLinkedInLoad

I have the possibility of LinkedIn login to my website, to postulate for a job. 我可以通过LinkedIn登录到我的网站,以推测工作。 . I followed the tutorial given on the LinkedIn developer page, this is my code: 我遵循了LinkedIn开发人员页面上给出的教程,这是我的代码:

 <script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:   [...]
    lang:      fr_FR
    authorize: false
    onLoad: onLinkedInLoad
</script>


<script type="text/javascript">

// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
    IN.Event.on(IN, "auth", getProfileData);
}

// Handle the successful return from the API call
function onSuccess(data) {
    console.log(data);
}

// Handle an error response from the API call
function onError(error) {
    console.log(error);
}

  function getProfileData(){
   [...]    
}
 </script>

The login button appears, this means that LinkedIn was able to connect to my API key correctly, but the Chrome console gives me the following error: Uncaught Error: Could not execute 'onLinkedInLoad'. 出现登录按钮,这意味着LinkedIn能够正确连接到我的API密钥,但是Chrome控制台向我显示以下错误:未捕获的错误:无法执行“ onLinkedInLoad”。 Please provide a valid function for callback.. 请提供有效的回调函数。

I tried to remove the onLinkedInLoad event listener : 我试图删除onLinkedInLoad事件侦听器:

<script type="text/javascript">
     IN.Event.on(IN, "auth", getProfileData);

 [...]

</script>

... but i have the same problem. ...但是我有同样的问题。

Theses scripts are called in head (php include of all pages of the website (i need this linkedin login on all pages)). 这些脚本在头中调用(php包含网站的所有页面(我需要在所有页面上都使用此linkedin登录名))。

It works on ONE page, but not on the others... i don't understand. 它可以在一页上工作,但不能在其他页面上工作...我不明白。

Thanks a lot ! 非常感谢 !

Need to below script available for all pages where you want login button. 需要以下脚本可用于要登录按钮的所有页面。 if you are putting this script on particular page then lgoin button will work on that page only. 如果您将此脚本放在特定页面上,则lgoin按钮将仅在该页面上起作用。

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key:   [...]
    lang:      fr_FR
    authorize: false
    onLoad: onLinkedInLoad
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM