-3
リンクされたjavascript SDKを使用したログインの実例はありますか?私は多くのデモを試しましたが、全く動作しません。login with linkedin javascript SDK
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 81yvk0mewiwqa6
authorize: true
onLoad: onLinkedInLoad
scope: r_basicprofile r_emailaddress
</script>
<script type="text/javascript">
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
alert("hi");
IN.Event.on(IN, "auth", getProfileData);
}
// Use the API call wrapper to request the member's profile data
function getProfileData() {
IN.API.Profile("me").fields("id", "first-name", "last-name", "headline", "location", "picture-url", "public-profile-url", "email-address").result(displayProfileData).error(onError);
}
// Handle the successful return from the API call
function displayProfileData(data){
var user = data.values[0];
document.getElementById("picture").innerHTML = '<img src="'+user.pictureUrl+'" />';
document.getElementById("name").innerHTML = user.firstName+' '+user.lastName;
document.getElementById("intro").innerHTML = user.headline;
document.getElementById("email").innerHTML = user.emailAddress;
document.getElementById("location").innerHTML = user.location.name;
document.getElementById("link").innerHTML = '<a href="'+user.publicProfileUrl+'" target="_blank">Visit profile</a>';
document.getElementById('profileData').style.display = 'block';
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
// Destroy the session of linkedin
function logout(){
IN.User.logout(removeProfileData);
}
// Remove profile data from page
function removeProfileData(){
document.getElementById('profileData').remove();
}
</script>
</head>
<script type="in/Login"></script>
<a href="javascript:void(0)" onclick="onLinkedInLoad();">Linked in</a>
私もこの問題を解決しようとしていますが、何が問題になっているのかわかりません。
また、
<script type="in/Login"></script>
この行は、LinkedInのボタンを表示することですが、それは何も表示されません! 誰も助けることができますか?
あなたがこれまでに試した持っているものを共有してくださいすることができますか? –
ねえ、私は私の質問を編集しました、ここで私が試したコードですが、動作しません。間違いは何ですか? –