title: Implementing OAuth on Dropbox API Python
body: <p>I'm trying to add a user to the development users of my dropbox app. In order to do so, it seems like I have to connect to the endpoints <code>/token/from_oauth1</code> or/and <code>/oauth2/token</code> to generate their access token. I'm new with using APIs and struggling to understand how to implement OAuth/OAuth2 into my code. I'm using the <code>requests</code> library do so.</p>
  
  <p>Here is a sample of what I've tried but hasn't been working for me:</p>
  
  <pre><code>import requests
  import json
  
  url = "https://api.dropboxapi.com/2/auth/token/from_oauth1"
  
  headers = {
      "Authorization": "Basic &lt;APP_KEY&gt;:&lt;APP_SECRET&gt;",
      "Content-Type": "application/json"
  }
  
  data = {
      "oauth1_token": "&lt;DROPBOX_USERNAME&gt;",
      "oauth1_token_secret": "&lt;DROPBOX_PASSWORD&gt;"
  }
  
  r = requests.post(url, headers=headers, data=json.dumps(data))
  </code></pre>
  
  <p>But I receive the error <code>b'Error in call to API function "auth/token/from_oauth1": Invalid value in HTTP header "Authorization": "Basic &lt;APP_KEY&gt;:&lt;APP_SECRET&gt;"'</code> </p>
  
  <p><code>APP_KEY</code> and <code>APP_SECRET</code> are obviously replaced with their corresponding strings.</p>
  
  <p>Am I right to be calling <code>/token/from_oauth1</code> rather than <code>/oauth2/token</code>. If so, where am I going wrong with this request?</p>