title: Linkedin Authentication new code every time - python
body: <p>I am trying to access linkedin with Python. Below is the simple code I am using. </p>
  
  <p>Problems is I need to login open browser every time to post the return_url for getting the authorization_code, it works for the first time when I run and this code expires when I re-run the python code.</p>
  
  <p>Below is my code: </p>
  
  <pre><code>from linkedin import linkedin
  API_KEY = '&lt;mykey&gt;'
  API_SECRET = '&lt;mysecret&gt;'
  RETURN_URL = 'https://www.linkedin.com/uas/oauth/authorize'
  authentication = linkedin.LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, linkedin.PERMISSIONS.enums.values())
  Url= authentication.authorization_url  # open this url on your browser
  print Url
  authentication.authorization_code ="&lt;authcode&gt;"
  application = linkedin.LinkedInApplication(authentication)
  authentication.get_access_token()
  </code></pre>