Uncaught (in promise) TypeError: Could not instantiate tag for 'login': Cannot read property 'on' of null

Dev
Dev
Member
40 Points
5 Posts

I am trying to implement Sign-In with linked in my web app. Getting error in browser console

Uncaught (in promise) TypeError: Could not instantiate tag for 'login': Cannot read property 'on' of null

Here is my code (https://developer.linkedin.com/docs/js-sdk/tutorials/getting-started):

<!-- 1. Include the LinkedIn JavaScript API and define a onLoad callback function -->
    <script type="text/javascript" src="https://platform.linkedin.com/in.js">
          api_key: 78is6yvweyla1k
          onLoad: onLinkedInLoad
          authorize: true
    </script>

    <script type="text/javascript">
        // 2. Runs when the JavaScript framework is loaded
        function onLinkedInLoad() {
            IN.Event.on(IN, "auth", onLinkedInAuth);
        }

        // 2. Runs when the viewer has authenticated
        function onLinkedInAuth() {
            IN.API.Profile("me").result(displayProfiles);
        }

        // 2. Runs when the Profile() API call returns successfully
        function displayProfiles(profiles) {
            member = profiles.values[0];
            document.getElementById("profiles").innerHTML =
                "<p id=\"" + member.id + "\">Hello " + member.firstName + " " + member.lastName + "</p>";
        }
    </script>

In body:

<script type="IN/Login"></script>
Views: 1555
Total Answered: 1
Total Marked As Answer: 1
Posted On: 01-Jan-2021 03:11

Share:   fb twitter linkedin
Answers
beginer
beginer
Member
1328 Points
43 Posts
         

LinkedIn no longer supports the JavaScript SDK. The recommended approach is to use OAuth 2.0 and LinkedIn's Auth APIs.

Update: As of May 1, 2019, Version 1.0 of our API is no longer supported. 
Applications requesting Version 1.0 APIs may experience issues as we begin to remove services.

https://engineering.linkedin.com/blog/2018/12/developer-program-updates

Now, you can refer doc for Sign-in: https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin

Posted On: 01-Jan-2021 23:15
Thanks
 - Dev  07-Jan-2021 07:20
 Log In to Chat