Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am using the POST request to get an new access token from this link.
When clicking <get app key and secret> I get a single string value. With these values I am running this POST request using Python's requests library. The error message I get is: Error in call to API function "auth/token/from_oauth1": Invalid value in HTTP header "Authorization": " Basic <my app key and secret> ".
headers = {
'Authorization': 'Basic <get app key and secret>',
'Content-Type': 'application/json',
}
data = '{"oauth1_token":"<some pre-generated value> ","oauth1_token_secret":"<some other pre-generated value> "}'
response = requests.post('https://api.dropboxapi.com/2/auth/token/from_oauth1', headers=headers, data=data)
Please help.
Thanks in advance.
I just tried the code you shared, plugging in my own encoded app key and secret value, and I didn't get the error you're getting. Please double check that you're passing in only that base64-encoded app key/secret pair there after "Basic ". Make sure you don't have any other stray characters accidentally included. For instance, make sure you don't have the "<" or ">" left in there.
By the way, this /2/auth/token/from_oauth1 endpoint is only meant for use if you already have pre-existing OAuth 1 access tokens. OAuth 1 access tokens were a feature of an old version of the Dropbox API. If you've only used API v2 and OAuth 2, for instance, if you're only developing your app now, you wouldn't have any OAuth 1 access tokens. If you don't have pre-existing OAuth 1 access tokens, you should send the user through the normal OAuth 2 app authorization flow. You can find information on how that works in the OAuth guide here:
https://www.dropbox.com/developers/reference/oauth-guide
The documentation for the OAuth 2 app authorization flow can be found here:
https://www.dropbox.com/developers/documentation/http/documentation#authorization
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!