One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
FRC2637Scouting
6 years agoNew member | Level 2
Invalid Access Token
var name = teamNum + "/" + matchNum + ".json";
var xhr = new XMLHttpRequest();
var filename = name;
var file = new File([JSON.stringify(dataset)], filename, { type: "text/json;charset=utf-8" });
xhr.open('POST', 'https://content.dropboxapi.com/2/files/upload');
xhr.setRequestHeader('Authorization', 'Bearer ' + <accessToken>);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.setRequestHeader('Dropbox-API-Arg', JSON.stringify({
path: '/Apps/BeachBlitz/' + file.name,
mode: 'overwrite',
autorename: false,
mute: false
}));
xhr.send(file);
The above code is giving me invalid access token but I definitely have a valid one. Does the above code look correct?
- Greg-DB
Dropbox Staff
I just tried this code and it worked fine for me.
Can you clarify what you mean when you say you "definitely have a valid one"? How did you get the access token and how are you verifying that it's still active?
While Dropbox API access tokens don't expire by themselves, there a number of different ways that a Dropbox API access token can become invalid:
- the user can revoke all access tokens for an app by unlinking it on the connected apps page
- the app (or anyone with access to the access token) can revoke an access token by calling /2/auth/token/revoke
- if the app uses the "app folder" permission, the token can be disabled by the user deleting the app folder itself in the Dropbox account, either via the Dropbox website or any client
- the app can be disabled
- the connected account can be disabled
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,941 PostsLatest Activity: 2 days ago
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 or Facebook.
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!