cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Find out how Tiffany, a Customer Experience superstar uses Dropbox to keep her family in the loop when it comes to her new baby here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Refresh token using dropbox-sdk-js returns 400 error

Refresh token using dropbox-sdk-js returns 400 error

nort99
New member | Level 2

Hi,

 

I'm using dropbox-sdk-js v10.5.0.

 

The use case is a single system with multiple users who submit files which we upload into a single Dropbox account. We used to use a long-lived token but now need to move across to the short lived tokens as they are being deprecated.

 

I have updated our system to include a one-off manual user flow to generate a refresh token (successfully), and store that refresh token on the server.

 

The JS client for subsequent users has access to that refresh token and it is passed into the Javascript library Dropbox constructor with no access token passed:

 

let dbx = new Dropbox({
clientId: data.dropbox.client_id,
//accessToken: ACCESS_TOKEN,
refreshToken: data.dropbox.refresh_token,
fetch: isoFetch,
});

 

I can see the logic in the library (https://github.com/dropbox/dropbox-sdk-js/blob/cc5136afe4df31284b29dde3933b4c7b72089086/src/auth.js#...) results in a POST request to the oauth2/token endpoint with grant_type of 'refresh_token', however the call results in a JSON error response:

 

{"error_description": "No auth function available for given request", "error": "invalid_request"}

 

When I test the endpoint manually, I have to pass a client_id/client_secret Authorization header, and I must not pass client_id. This doesn't seem to be how the JS library functions.

 

Can you tell me how I should be using this library with a refresh token, so that it automatically creates a new access token on initialisation?

1 Reply 1

Re: Refresh token using dropbox-sdk-js returns 400 error

Greg-DB
Dropboxer

[Cross-linking for reference: https://github.com/dropbox/dropbox-sdk-js/issues/769 ]

 

I've followed up on your GitHub post.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?