title: Facebook: How to get/update user access token using python?
body: <p>Currently am using <code>Graph Explorer</code> to get a short-lived user access token and than converting it to a <code>extended token(60 days)</code> by a call to <a href="https://facepy.readthedocs.org/en/latest/usage/utilities.html#facepy.utils.get_extended_access_token" rel="nofollow noreferrer">facepy get_extended_access_token</a> method.</p>
  
  <p>Now. consider the scenario where my user access token becomes invalid because of either user logging out or the token expires itself. So, in both the cases I need to get a new user access token because <code>get_extended_access_token</code> requires <code>access_token</code> so that it can extend it.</p>
  
  <p>So, my question is how to retrieve this token using python? Is there any particular url which I can send a request and it will return a new/updated token in resonse.</p>
  
  <p><strong>Update</strong>:</p>
  
  <p>So, after following <a href="https://stackoverflow.com/questions/3058723/programmatically-getting-an-access-token-for-using-the-facebook-graph-api">this post</a> and making a request to </p>
  
  <pre><code>https://graph.facebook.com/oauth/access_token?client_id=xxxx&amp;client_secret=yyyy&amp;grant_type=client_credentials
  </code></pre>
  
  <p>I got this token which I believe is an <code>app access token</code> </p>
  
  <pre><code>access_token=123456789|12abcdef234 #changed from original
  </code></pre>
  
  <p>But what I need is an user access token through which I can read my mailbox.</p>