SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,045
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linkedin login help

    Hi Guys!

    I am trying to use LinkedIn API to authenticate a user and get their member info to prefill a registration form.

    Here's the code I am using:

    Code HTML4Strict:
    <script type="text/javascript" src="http://platform.linkedin.com/in.js">
      api_key: 92b7wk2jrrfl
      onLoad: onLinkedInLoad
      authorize: true
    </script>
     
    function onLinkedInLoad() {
    	IN.Event.on(IN, "auth", onLinkedInAuth);
    }
    function onLinkedInAuth() {
    	IN.API.Profile("me").result(displayProfiles);
    }
    function displayProfiles(profiles) {
    	member = profiles.values[0];
    	document.getElementById("first_name").value = member.firstName;
    	document.getElementById("last_name").value = member.lastName;
    }

    It's filling in my data but I have to refresh the page first for the data to be loaded. Is there some option to do this automatically?

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Is that the code you're actually using? If so, there are a couple of mistakes:

    • If your <script> tag loads an external file, it cannot also have JS embedded in it. Read more from John Resig: Degrading Script Tags
    • Your three functions aren't wrapped in a <script> tag at all!
    I'm the web overlord for Graphic Business Systems

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,045
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sdleihssirhc View Post
    Is that the code you're actually using? If so, there are a couple of mistakes:

    • If your <script> tag loads an external file, it cannot also have JS embedded in it. Read more from John Resig: Degrading Script Tags
    • Your three functions aren't wrapped in a <script> tag at all!
    Sorry if it was misleading but the code is actually wrapped in tags on my site. However, the first point that you make about JS cannot be embedded if the tag loads an external URL - not sure that is true as this is code that I copied directly from the LinkedIn dev site. :/

  4. #4
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ah good, just me being an idiot

    Can you link to a live example?
    I'm the web overlord for Graphic Business Systems


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •