cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error in call to API function "auth/token/from_oauth1": Invalid value in HTTP header "Authorization"

Error in call to API function "auth/token/from_oauth1": Invalid value in HTTP header "Authorization"

jasonedlewis
Explorer | Level 3

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.

1 Reply 1

Greg-DB
Dropbox Staff

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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?