Thursday, 9 October 2014

Custom linkedin button for share and auth









  1. <script src="http://platform.linkedin.com/in.js">
  2. api_key:
  3. //onLoad: onLinkedInLoad
  4. scope: r_basicprofile r_emailaddress r_fullprofile
  5. authorize:true
  6. </script>
  7. <script>
  8. function onLinkedInAuth() {
  9. IN.API.Profile("me")
  10. .fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary", "num-connections", "public-profile-url", "distance", "positions", "email-address", "educations", "date-of-birth")
  11. .result(displayProfiles);
  12. IN.UI.Share().params({
  13. url: "http://www.example.com"
  14. }).place()
  15. }

  16. function displayProfiles(profiles) {
  17. console.log(profiles);
  18. member = profiles.values[0];
  19. }

  20. jQuery(document).ready(function(){
  21. jQuery("#linkdinlog").click(function(){
  22. IN.UI.Authorize().place();
  23. IN.Event.on(IN, "auth", onLinkedInAuth);
  24. });
  25. });
  26. </script><a href="javascript:void(0)" id="linkdinlog">link</a>