title: Want to fetch data of user using id in linkedin using rest api
body: <p>I am using Linkedin Oauth 2.0 . Here i have fetch the token in the code below next step is that i want to fetch info of a user whose email id i'll be passing. But its giving error unable to load resource error:500.</p>
  
  <p>Below is the code:</p>
  
  <pre><code> chrome.identity.launchWebAuthFlow({
      "url": " https://www.linkedin.com/uas/oauth2/authorization?&amp;response_type=code&amp;client_id=" + clientid + 
                  "&amp;redirect_uri=" + encodeURIComponent(redirectUri) +
                  "&amp;state=121212121"
  
                    ,'interactive': true,  
                  },
                  function(redirect_url) { 
                      var pairs = redirect_url.split('/');
                      var values = {};
                      var code1 = redirect_url.split('?');
                      var code2 = code1[1].split('&amp;');
                      var code3 = code2[0].split('=');
                      var actualCode = code3[1];// actual code obtained in request
                      var deferred = $q.defer();
                      var req = {
                          method: 'POST',
                          url: 'https://www.linkedin.com/uas/oauth2/accessToken?&amp;grant_type=authorization_code&amp;code=' + actualCode + 
                          '&amp;redirect_uri='+ redirectUri + '&amp;client_id=' + clientid + '&amp;client_secret=' + clientSecretKey,
                          headers:{
                              'Access-Control-Expose-Headers': 'X-My-Custom-Header, X-Another-Custom-Header'
                          } 
                      }
                      $http(req).then(function(data){
                          deferred.resolve(data);
                          console.log("deferred.resolve(data)"+ data.data.access_token ); // gives the token generated
  
                          var req2 = {
                              method: 'GET',
                              url: 'https://api.linkedin.com/v1/people/email=xxxx@gmail.com:(first-name,last-name)?format=json',
                              headers :{
                                  'oauth_token': data.data.access_token,
                                  'x-li-format': 'json'
                              }
                          }
                          $http(req2).then(function(data1){
                              deferred.resolve(data1);
                              console.log("sndsnd");
                              console.log("deferred.resolve(data)"+ data1.data );
                          });
                      });
                  }
              );
  </code></pre>