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: 

Invalid Access Token

Invalid Access Token

FRC2637Scouting
New member | Level 2

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?

1 Reply 1

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
Need more support?
Who's talking

Top contributors to this post

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