2012-08-22 52 views
0

我正在尝试将LinkedIn登录功能集成到我的网站上,但按钮不显示。代码是:LinkedIn Api登录按钮不显示

<head><script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    <body> 

<script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 
</script> 
    </body> 
</head> 

我已经制作了这个jsfiddle它也有帮助。

我在编程的耳朵后面相当湿,所以我确信它的一些简单的东西,当我们想要理解整个api时,我很想念它。一点帮助就足够了。

回答

2

你提供的html都搞砸了 - 身体不应该高于头部!查看thisthis了解基础知识。

enter image description here

要获得登录页面如下说明linkedin developer page

首先,您需要get an API key

比,建立HTML是这样的:

<html> 
<head> 
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    api_key: YOUR_API_KEY_GOES_HERE 
    authorize: true 
</script> 

<script type="text/javascript"> 
function onLinkedInAuth() { 
    IN.API.Profile("me") 
    .result(function(me) { 
     var id = me.values[0].id; 
     // AJAX call to pass back id to your server 
    }); 
} 
</script> 
</head> 

<body> 
<script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 


</body> 
</html> 
0

好你的订单出现问题与您的标签。你不能把身体标签放在头上。尝试也许这:

<head> 
    <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script> 
</head> 
<body> 
    <script type="IN/Login" data-onAuth="onLinkedInAuth"></script> 
</body> 

但我不知道,如果你的第二个脚本做得正确,因为我不知道LinkedIn的API的工作原理。

0
<head> 
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> 
    api_key: YOUR_API_KEY 

</script> 
</head> 
<body> 
<script type="IN/Login"> 
    Hello, <?js= firstName ?> <?js= lastName ?>. 
</script> 
</body> 
相关问题