问题描述
我想在我的网页上实现“使用Linkedin注册”,但是我一直在控制台上遇到错误。
Uncaught (in promise) TypeError: Could not instantiate tag for 'login': Cannot read property 'on' of null
at new <anonymous> (Login.js?version=0.1.149:7)
at in.js:18
我尝试了Internet上几乎所有可用的方法,但还没有走运。我敢肯定,这种方法现在已经过时了,并且有一种新的方法可以做到这一点,但是在任何论坛上都还没有。
这是我正在运行的:
<HTML>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://platform.linkedin.com/in.js">
api_key: <API Key>
authorize: true
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);
}
// Use the API call wrapper to request the member's basic profile data
function getProfileData() {
IN.API.Profile("me").fields("first-name","last-name","email-address").result(function (data) {
var userdata = data.values[0];
console.log('FName: ' + userdata.firstName);
console.log('LName: ' + userdata.lastName);
console.log('Email: ' + userdata.emailAddress);
}).error(function (data) {
console.log(data);
});
}
</script>
</head>
<body>
<!-- LinkedIn signin button -->
<script type="IN/Login" data-onAuth="onLinkedInAuth"></script>
</body>
</html>
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)