cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

OPTIONS https://api.dropboxapi.com/2/files/list_folder 400 (Bad Request)

OPTIONS https://api.dropboxapi.com/2/files/list_folder 400 (Bad Request)

JasN
Explorer | Level 3
Go to solution

I am using typescript to get a list of folder contents from Dropbox account, I keep getting a 400 Bad Request.

 

I have created a plunker where you can see my code https://plnkr.co/edit/8f0qZm02qkxYhxig31PT?p=preview

 

If you look in the browser developer tools you will see the error. What am I doing wrong?

 

Thanks in advance

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Looking at the response body for the 400, the error is:

 

 

CORS preflight failed.  The following HTTP headers are not allowed: "bearer".

 

"Bearer" isn't the header though. The header should be "Authorization", with "Bearer" as part of the value. That is, instead of this line:

 

let headers = new Headers({ 'Bearer': 'my_oauth2_token' });

it should be:

let headers = new Headers({ 'Authorization': 'Bearer my_oauth2_token' });

 

 

 

View solution in original post

1 Reply 1

Greg-DB
Dropbox Staff
Go to solution

Looking at the response body for the 400, the error is:

 

 

CORS preflight failed.  The following HTTP headers are not allowed: "bearer".

 

"Bearer" isn't the header though. The header should be "Authorization", with "Bearer" as part of the value. That is, instead of this line:

 

let headers = new Headers({ 'Bearer': 'my_oauth2_token' });

it should be:

let headers = new Headers({ 'Authorization': 'Bearer my_oauth2_token' });

 

 

 

Need more support?
Who's talking

Top contributors to this post

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