I'm attempting to upload files from the browser to a Dropbox folder on the user's account. The way I have it set up right now, OAuth2 is triggered using a link, which then redirects to the server when done and the server saves the token with the user's data in the database. That token is then sent back to the user whenever they're on the uploading page. When a file is uploaded, I'm trying to PUT it to the /files_put endpoint using JQuery's AJAX method. The problem I'm having is that whenever I try to upload the file I get an error stating
XMLHttpRequest cannot load https://api-content.dropbox.com/1/files_put/auto/Apps/The%20Worm/a7a0122fedc9478d95caa63546fe6024.jpg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' https://localhost:3363' is therefore not allowed access.
I'm not entirely sure what to do from here. It would probably work if I were to have the file sent to my server and then out to Dropbox, but I want to avoid that, as that would be slow and would count as double data transfer in and out of my server. With a little bit of research, it would seem that the Access-Control-Allow-Origin header needs to be set on Dropbox's end.