title: Customize LinkedIn Sign in button
body: <p>How can I customize the LinkedIn sign in button? The default LinkedIn button is small. I have tried the codes in <a href="https://stackoverflow.com/questions/18463713/customizing-linkedin-login-button">here</a>, but I couldn't get it to work.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>&lt;script type="text/javascript" src="//platform.linkedin.com/in.js"&gt;
      api_key: #my key
      onLoad: onLinkedInLoad
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>The button:</strong> </p>
  
  <pre><code>&lt;script type="in/Login"&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>The script:</strong></p>
  
  <pre><code>// Setup an event listener to make an API call once auth is complete
  function onLinkedInLoad() {
      IN.Event.on(IN, "auth", getProfileData);
  }
  
  // Handle the successful return from the API call
  function onSuccess(data) {
      var linkedInData =  JSON.stringify(data);
      logIn(linkedInData)
  }
  
  // Handle an error response from the API call
  function onError(error) {
      console.log(error);
  }
  
  // Use the API call wrapper to request the member's basic profile data
  function getProfileData() {
      IN.API.Raw("/people/~").result(onSuccess).error(onError);
  }
  
  function logIn(data){
    $.ajax({
          type: "POST",
          url: URL_POST_AJAX,
          data: {
              'data' : data,
            },
          success: function (response) {
             window.location.href = response.next_page;
          },
          error: function (data) {
              alert('failed');
          }
      });}
  
  // CSRF code
  function getCookie(name) {
      var cookieValue = null;
      var i = 0;
      if (document.cookie &amp;&amp; document.cookie !== '') {
          var cookies = document.cookie.split(';');
          for (i; i &lt; cookies.length; i++) {
              var cookie = jQuery.trim(cookies[i]);
              // Does this cookie string begin with the name we want?
              if (cookie.substring(0, name.length + 1) === (name + '=')) {
                  cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                  break;
              }
          }
      }
      return cookieValue;
  }
  
  var csrftoken = getCookie('csrftoken');
  
  function csrfSafeMethod(method) {
      // these HTTP methods do not require CSRF protection
      return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
  }
  
  $.ajaxSetup({
      crossDomain: false, // obviates need for sameOrigin test
      beforeSend: function (xhr, settings) {
          if (!csrfSafeMethod(settings.type)) {
              xhr.setRequestHeader("X-CSRFToken", csrftoken);
          }
      }
  });
  </code></pre>