LinkedIn SDK Logout Error: 'no XD object is available from this page'












-2















I'm currently using the LinkedIn JS SDK as documented here for my AngularJS application. I'm inserting the following script into the head block of my page:



<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: [apiKey]
authorize: false
</script>


Then I initiate authorization with an onclick function on a button like so



IN.User.authorize(function(){
callback();
});


At this point the user is authenticated with LinkedIn and I can use LinkedIn's APIs.



When the user decides to log out, I use the call IN.User.logout() to end the user's session. However, the call causes this error 'Uncaught Error: no XD object is available from this page' to appear in the JavaScript console.



This only happen sometimes, and I'm unsure of why this exact issue occurs. Most of the time, the SDK will logout the session normally. I make sure that the LinkedIn framework is loaded before calling any functions and I call IN.User.isAuthorized() before making a call to logout. Does anyone have an idea of what I may be doing wrong?



if (IN.User.isAuthorized()) {  // Returns true
IN.User.logout(); // Prints `'Uncaught Error: no XD object is available from this page' error
}


EDIT:



I'm looking more into the source code and it shows this function being called:



Sslac.Function("IN.Support.getXD", function() {
function a() {
throw Error("no XD object is available from this page");
}
try {
return IN.Support.isSingleJS() && IN.Support.isPopup() ? IN.Support.generateXDProxy() : IN.Support.isPopup() ? window.opener.getXD || a : IN.Support.isIframe() ? window.parent.getXD || a : a
} catch (b) {
return a
}
}());


But the IN.Support object is null which is why this error is being thrown. Could anyone from LinkedIn help with this? It looks like there's some kind of race condition.










share|improve this question





























    -2















    I'm currently using the LinkedIn JS SDK as documented here for my AngularJS application. I'm inserting the following script into the head block of my page:



    <script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: [apiKey]
    authorize: false
    </script>


    Then I initiate authorization with an onclick function on a button like so



    IN.User.authorize(function(){
    callback();
    });


    At this point the user is authenticated with LinkedIn and I can use LinkedIn's APIs.



    When the user decides to log out, I use the call IN.User.logout() to end the user's session. However, the call causes this error 'Uncaught Error: no XD object is available from this page' to appear in the JavaScript console.



    This only happen sometimes, and I'm unsure of why this exact issue occurs. Most of the time, the SDK will logout the session normally. I make sure that the LinkedIn framework is loaded before calling any functions and I call IN.User.isAuthorized() before making a call to logout. Does anyone have an idea of what I may be doing wrong?



    if (IN.User.isAuthorized()) {  // Returns true
    IN.User.logout(); // Prints `'Uncaught Error: no XD object is available from this page' error
    }


    EDIT:



    I'm looking more into the source code and it shows this function being called:



    Sslac.Function("IN.Support.getXD", function() {
    function a() {
    throw Error("no XD object is available from this page");
    }
    try {
    return IN.Support.isSingleJS() && IN.Support.isPopup() ? IN.Support.generateXDProxy() : IN.Support.isPopup() ? window.opener.getXD || a : IN.Support.isIframe() ? window.parent.getXD || a : a
    } catch (b) {
    return a
    }
    }());


    But the IN.Support object is null which is why this error is being thrown. Could anyone from LinkedIn help with this? It looks like there's some kind of race condition.










    share|improve this question



























      -2












      -2








      -2








      I'm currently using the LinkedIn JS SDK as documented here for my AngularJS application. I'm inserting the following script into the head block of my page:



      <script type="text/javascript" src="//platform.linkedin.com/in.js">
      api_key: [apiKey]
      authorize: false
      </script>


      Then I initiate authorization with an onclick function on a button like so



      IN.User.authorize(function(){
      callback();
      });


      At this point the user is authenticated with LinkedIn and I can use LinkedIn's APIs.



      When the user decides to log out, I use the call IN.User.logout() to end the user's session. However, the call causes this error 'Uncaught Error: no XD object is available from this page' to appear in the JavaScript console.



      This only happen sometimes, and I'm unsure of why this exact issue occurs. Most of the time, the SDK will logout the session normally. I make sure that the LinkedIn framework is loaded before calling any functions and I call IN.User.isAuthorized() before making a call to logout. Does anyone have an idea of what I may be doing wrong?



      if (IN.User.isAuthorized()) {  // Returns true
      IN.User.logout(); // Prints `'Uncaught Error: no XD object is available from this page' error
      }


      EDIT:



      I'm looking more into the source code and it shows this function being called:



      Sslac.Function("IN.Support.getXD", function() {
      function a() {
      throw Error("no XD object is available from this page");
      }
      try {
      return IN.Support.isSingleJS() && IN.Support.isPopup() ? IN.Support.generateXDProxy() : IN.Support.isPopup() ? window.opener.getXD || a : IN.Support.isIframe() ? window.parent.getXD || a : a
      } catch (b) {
      return a
      }
      }());


      But the IN.Support object is null which is why this error is being thrown. Could anyone from LinkedIn help with this? It looks like there's some kind of race condition.










      share|improve this question
















      I'm currently using the LinkedIn JS SDK as documented here for my AngularJS application. I'm inserting the following script into the head block of my page:



      <script type="text/javascript" src="//platform.linkedin.com/in.js">
      api_key: [apiKey]
      authorize: false
      </script>


      Then I initiate authorization with an onclick function on a button like so



      IN.User.authorize(function(){
      callback();
      });


      At this point the user is authenticated with LinkedIn and I can use LinkedIn's APIs.



      When the user decides to log out, I use the call IN.User.logout() to end the user's session. However, the call causes this error 'Uncaught Error: no XD object is available from this page' to appear in the JavaScript console.



      This only happen sometimes, and I'm unsure of why this exact issue occurs. Most of the time, the SDK will logout the session normally. I make sure that the LinkedIn framework is loaded before calling any functions and I call IN.User.isAuthorized() before making a call to logout. Does anyone have an idea of what I may be doing wrong?



      if (IN.User.isAuthorized()) {  // Returns true
      IN.User.logout(); // Prints `'Uncaught Error: no XD object is available from this page' error
      }


      EDIT:



      I'm looking more into the source code and it shows this function being called:



      Sslac.Function("IN.Support.getXD", function() {
      function a() {
      throw Error("no XD object is available from this page");
      }
      try {
      return IN.Support.isSingleJS() && IN.Support.isPopup() ? IN.Support.generateXDProxy() : IN.Support.isPopup() ? window.opener.getXD || a : IN.Support.isIframe() ? window.parent.getXD || a : a
      } catch (b) {
      return a
      }
      }());


      But the IN.Support object is null which is why this error is being thrown. Could anyone from LinkedIn help with this? It looks like there's some kind of race condition.







      javascript linkedin linkedin-jsapi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 18:14







      jalamak

















      asked Nov 21 '18 at 19:16









      jalamakjalamak

      42




      42
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I could not fix the 'no XD object is available from this page' error. As a workaround, I called the logout URL itself to end the user session. This still causes the error to appear in the console but the logout function fully completes this way.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419104%2flinkedin-sdk-logout-error-no-xd-object-is-available-from-this-page%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I could not fix the 'no XD object is available from this page' error. As a workaround, I called the logout URL itself to end the user session. This still causes the error to appear in the console but the logout function fully completes this way.






            share|improve this answer




























              0














              I could not fix the 'no XD object is available from this page' error. As a workaround, I called the logout URL itself to end the user session. This still causes the error to appear in the console but the logout function fully completes this way.






              share|improve this answer


























                0












                0








                0







                I could not fix the 'no XD object is available from this page' error. As a workaround, I called the logout URL itself to end the user session. This still causes the error to appear in the console but the logout function fully completes this way.






                share|improve this answer













                I could not fix the 'no XD object is available from this page' error. As a workaround, I called the logout URL itself to end the user session. This still causes the error to appear in the console but the logout function fully completes this way.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 19:28









                jalamakjalamak

                42




                42






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419104%2flinkedin-sdk-logout-error-no-xd-object-is-available-from-this-page%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen