Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
hello,
I get an error 401 trying to connect to my dropbox, this is my code:
let dbx = new Dropbox.Dropbox({ accessToken: "REDACTED", clientId: "REDACTED", clientSecret: "REDACTED" });
dbx.filesListFolder({ path: "" })
.then(function (response) {
if (response.result.entries > 1) {
return true
} else {
return false
}
})
.catch(function (error) {
alert(error);
});
the same credentials works perfect on the server side in C#:
var dbx = new DropboxClient(DropBoxClass.Refresh_Token, DropBoxClass.Appkey, DropBoxClass.Appsecret);
In your JavaScript code, you're using the token as an access token, however in your .NET code, you're using the token as a refresh token. Access tokens and refresh tokens are different objects and are not interchangeable, so you can't use the same token both ways like that.
If the token you have is a refresh token, you should supply it to the JavaScript SDK Dropbox constructor using the "refreshToken" parameter (not "accessToken").
Also, I have now redacted them, but you posted your credentials here publicly. These credentials enable access to the connected account, and so as a matter of security should not be shared. That being the case, you may want to revoke them now since they're been exposed.
Hi there!
If you need more help you can view your support options (expected response time for a 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!