Как создать логин входа в angular 9? - PullRequest
0 голосов
/ 18 марта 2020

Я пытаюсь войти в систему angular 9, используя ссылку, но не могу найти какой-либо возможный способ сделать это. Я гуглил это, но я не могу найти какую-либо социальную библиотеку для входа в систему для angular 9, которая работает для linkedin. Вся библиотека использует angular 6 или менее версию. Я пробовал много социальных библиотек логин angular 9.

<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 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>

1 Ответ

0 голосов
/ 18 марта 2020

Вы смотрели на начало работы с JavaScript SDK от Linkedin?

URL: https://developer.linkedin.com/docs/getting-started-js-sdk#

...