Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

JasN's avatar
JasN
Explorer | Level 3
9 years ago
Solved

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

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

  • 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' });

     

     

     

1 Reply

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    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' });

     

     

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

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!