Javascript 如何显示LinkedIn登录按钮
嗨,我正在尝试让LinkedIn api在一个基本的层面上工作。我制作了一个显示LinkedIn登录按钮的HTML页面。我按照LinkedIn开发者页面上的步骤直接复制了代码。我想知道我是否对OAuth2.0有问题Javascript 如何显示LinkedIn登录按钮,javascript,html,api,linkedin,Javascript,Html,Api,Linkedin,嗨,我正在尝试让LinkedIn api在一个基本的层面上工作。我制作了一个显示LinkedIn登录按钮的HTML页面。我按照LinkedIn开发者页面上的步骤直接复制了代码。我想知道我是否对OAuth2.0有问题 <!DOCTYPE html> <html lang="en"> <head> <title>LinkedIn Api</title> <meta charset="utf-8"> <meta
<!DOCTYPE html>
<html lang="en">
<head>
<title>LinkedIn Api</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Linked In java script Api initialize -->
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: myKey
onLoad: onLinkedInLoad
authorize: true
</script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
// 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);
}
// Use the API call wrapper to request the member's basic profile data
function getProfileData() {
IN.API.Raw("/people/~").result(onSuccess).error(onError);
}
</script>
</head>
<body>
<div class="container">
<script type="in/Login" src="//platform.linkedin.com/in.js"></script>
</div>
</body>
</html>
LinkedIn Api
api_密钥:myKey
onLoad:onLinkedInLoad
授权:正确
//设置事件侦听器,以便在完成身份验证后进行API调用
函数onLinkedInLoad(){
IN.Event.on(在“auth”中,getProfileData);
}
//处理API调用的成功返回
函数onSuccess(数据){
控制台日志(数据);
}
//处理来自API调用的错误响应
函数onError(错误){
console.log(错误);
}
//使用API调用包装器请求成员的基本配置文件数据
函数getProfileData(){
IN.API.Raw(“/people/~”).result(onSuccess).error(onError);
}
您遇到了什么错误?你还没有说什么不起作用的地方。@JustinKominar老实说,当我打开链接时,什么都没有显示,我觉得错误出在我的OAuth2.0登录上。你得到的错误是什么?你还没有说什么不起作用的地方。@JustinKominar老实说,当我打开链接时,什么都没有显示,我觉得错误在于我的OAuth2.0登录