Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Abhishek L.
11 years agoNew member | Level 1
Access-Control-Allow-Origin Issue using Core API via DfB Team API
I'm trying to use a Dropbox API, specifically one that allows a team administrator to take action for the team member, but I keep getting an access-control-error.
Here's my code:
$(document.body).on('click', '.viewfolders', function() {
var teamMember = $(this).closest('tr').attr('id');
//JSONinputs = {"list": "true"};
jQuery.ajax( {
url: 'https://api.dropbox.com/1/account/info',
type: 'GET',
dataType: 'json',
contentType: 'application/json',
headers: {
'X-Dropbox-Perform-As-Team-Member': + teamMember,
"Authorization": "Bearer " + access_token
},
beforeSend : function( xhr ) {
xhr.setRequestHeader( "Access-Control-Allow-Origin", "*");
},
success: function(rootresult) {
alert('success');
},
error: function(response) {
alert('error ' + JSON.stringify(response));
}
});
});
Here's the error I get:
XMLHttpRequest cannot load https://api.dropbox.com/1/account/info. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Any ideas on what's going on here? Have tried using JSONP as a dataType and gotten a 401 authorization error. Not sure what I'm doing wrong here
3 Replies
Replies have been turned off for this discussion
- Abhishek L.11 years agoNew member | Level 1
Also, I am using this locally (no localhost or online domain, just my HDD)
- Greg-DB11 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/31038598/access-control-allow-origin-error-when-using-dropbox-api ]
This looks like a bug on our side. We're looking into it.
- Greg-DB11 years ago
Dropbox Community Moderator
This should be fixed now.
About 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!