title: Login with LinkedIn Api using Codeigniter?
body: <p><strong>I am trying to login with linkedin api using codeigniter.My code is like this.</strong></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>&lt;?php
  class User extends CI_Controller
  {
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;library('session');
      }
      function index()
      {
          echo anchor('user/login', 'Sign in with Linkedin');
      }
      function login()
      {
          $data['api_key'] = "xxxxxxxx";
          $data['api_secret'] = "xxxxxxx";
          $data['callback_url'] = base_url()."user/login";
         $this-&gt;load-&gt;library("LinkedIn",$data);
         //echo $data['callback_url'];
         $linked = new LinkedIn($data);
         $url = urldecode($linked-&gt;getLoginUrl(
          array(
      LinkedIn::SCOPE_BASIC_PROFILE, 
      LinkedIn::SCOPE_EMAIL_ADDRESS,
    )
         ));   
         //echo $url;
         if(isset($_GET['code']))
         {
          $code = $_GET['code'];
          $access_token = $linked-&gt;getAccessToken($code);
          $token_expires = $linked-&gt;getAccessTokenExpiration();
          $linked-&gt;setAccessToken($access_token);
          //$user=$linked-&gt;get('v1/people/~:(firstName,lastName)','get',$access_token);
         //$info = $linked-&gt;get('/people/~:(first-name,last-name,company,positions)');
          $profile_fileds = array(
              'id',
              'firstName',
              'maiden-name',
              'lastName',
              'picture-url',
              'email-address',
              'location:(country:(code))',
              'industry',
              'summary',
              'specialties',
              'interests',
              'public-profile-url',
              'last-modified-timestamp',
              'num-recommenders',
              'date-of-birth',
          );
          $profileData = $linked-&gt;get('/people/~:(' . implode(',', $profile_fileds) . ')');
          var_dump($profileData);
         }
         else
         {
              redirect($url);
         }
      }
      function cancel()
      {
          echo "canecl by user";
      }
  
  }
  </code></pre>
  
  <p>The first time my code worked correctly but when i refresh the page it give me an errror like that</p>
  
  <blockquote>
    <p>Type: RuntimeException
    Message: Access Token Request Error: invalid_request -- missing required >parameters, includes an invalid parameter value, parameter more than once. : >Unable to retrieve access token : appId or redirect uri does not match >authorization code or authorization code expired</p>
  </blockquote>