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: 

error? in dbx.usersGetCurrentAccount() in javascript

error? in dbx.usersGetCurrentAccount() in javascript

anthonyhaffey
Explorer | Level 4

It looks like there's a new structure with dropbox, as of this morning I've been creating my dbx object by calling 

var dbx = new Dropbox.Dropbox({ clientId: CLIENT_ID });

rather than

var dbx = new Dropbox({ clientId: CLIENT_ID });

 

Whilst that seems to do the trick, when I try

 

dbx.usersGetCurrentAccount()

which seems to have worked before, I now get the error:

 

Uncaught (in promise) {error: "Error in call to API function "users/get_current_a…nt": request body: could not decode input as JSON", response: Response, status: 400}

 

The documentation at https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#usersGetCurrentAccount__anchor suggests no input is required for this? So is this a bug, or can I access the current user's account a different way?

 

In my instance, I would like to access the email address the user logged in on.

 

Thanks in advance!

8 Replies 8

Greg-DB
Dropbox Staff
Thanks for the report. We're looking into it. I'll follow up here once I have more information on this for you.

Greg-DB
Dropbox Staff
The API v2 JavaScript SDK just received a major revision that includes breaking changes, with a corresponding major version bump. You can find the release notes here:

https://github.com/dropbox/dropbox-sdk-js/releases/tag/v3.0.0

This includes a change to how the `Dropbox` object is constructed. In short, as of v3.0.0, you should now use `Dropbox.Dropbox` instead.

In order to avoid major version changes from breaking your app, you can instead import specific versions of the library.

Exactly how you do so depends on where you're loading the library from.

For instance, unpkg has information on specifying particular versions here: https://unpkg.com/

Anyway, there appears to be a bug with `usersGetCurrentAccount` in the new release. We're investigating that, and I'll let you know once I have an update on that.

Greg-DB
Dropbox Staff
The bug with usersGetCurrentAccount should be fixed now, as of v3.0.1. Please try again and let me know if you're still seeing any issues. Thanks!

anthonyhaffey
Explorer | Level 4

That was quicker than I thought it was going to be, so I reverted to 2.5.13.

 

Sorry to ask a N00b question, but I <script> link to the versions on https://cdnjs.com/libraries/dropbox.js/ as that means it's just one file - can you let me know when it's on there? And is there a reason I shouldn't do that generally? I'm now downloading each .min.js file onto my server and linking to it.

Greg-DB
Dropbox Staff

v3.0.1 is now available at https://cdnjs.com/libraries/dropbox.js/.

The Dropbox API v2 JavaScript SDK follows "semantic versioning":

https://github.com/dropbox/dropbox-sdk-js#versioning

That means that we will increase the major version number whenever there are breaking changes, such as the new constructor above. In general, you should avoid automatically using the latest version, i.e., including any major version updates, as your code may break when a major update is released. You should only upgrade to the latest major updates in your released app once you've had a chance to test it in your app and make any necessary changes

anthonyhaffey
Explorer | Level 4

Thanks for the advice - I was linking automatically to the latest version which is why I had breaking. I think I'll proceed with downloading a specific version into my own library and linking to that to avoid breaking.

 

As a general question, how long are the lags when getting new links - just tried https://cdnjs.cloudflare.com/ajax/libs/dropbox.js/3.0.1/Dropbox-sdk.min.js and got "404 Not Found" despite it being listed on https://cdnjs.com/libraries/dropbox.js/ 

 

Thanks!

Greg-DB
Dropbox Staff
Oh, sorry I didn't try the links themselves. I can't speak to how long that lag is unfortunately, as that's out of our control.

anthonyhaffey
Explorer | Level 4

No problem. As things seem to be working on the 2.5.13 version I'll probably hold off on moving over for a few days/week+. I''ll post the outcome on this forum though when I do.

 

Thanks for all your help!

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    anthonyhaffey Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?