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 /token/from_oauth1 or/and /oauth2/token 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 requests library do so.
Here is a sample of what I've tried but hasn't been working for me:
import requests
import json
url = "https://api.dropboxapi.com/2/auth/token/from_oauth1"
headers = {
"Authorization": "Basic <APP_KEY>:<APP_SECRET>",
"Content-Type": "application/json"
}
data = {
"oauth1_token": "<DROPBOX_USERNAME>",
"oauth1_token_secret": "<DROPBOX_PASSWORD>"
}
r = requests.post(url, headers=headers, data=json.dumps(data))
But I receive the error b'Error in call to API function "auth/token/from_oauth1": Invalid value in HTTP header "Authorization": "Basic <APP_KEY>:<APP_SECRET>"'
APP_KEY and APP_SECRET are obviously replaced with their corresponding strings.
Am I right to be calling /token/from_oauth1 rather than /oauth2/token. If so, where am I going wrong with this request?