<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Refresh token using dropbox-sdk-js returns 400 error in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Refresh-token-using-dropbox-sdk-js-returns-400-error/m-p/538793#M2072</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using&amp;nbsp;dropbox-sdk-js v10.5.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;let &lt;/SPAN&gt;&lt;SPAN&gt;dbx &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;Dropbox({&lt;BR /&gt;    &lt;SPAN&gt;clientId&lt;/SPAN&gt;: &lt;SPAN&gt;data&lt;/SPAN&gt;.dropbox.client_id,&lt;BR /&gt;    &lt;SPAN&gt;//accessToken: ACCESS_TOKEN,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;refreshToken&lt;/SPAN&gt;: &lt;SPAN&gt;data&lt;/SPAN&gt;.dropbox.refresh_token,&lt;BR /&gt;    &lt;SPAN&gt;fetch&lt;/SPAN&gt;: &lt;SPAN&gt;isoFetch&lt;/SPAN&gt;,&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see the logic in the library (&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/cc5136afe4df31284b29dde3933b4c7b72089086/src/auth.js#L348" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/cc5136afe4df31284b29dde3933b4c7b72089086/src/auth.js#L348&lt;/A&gt;) 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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;{"error_description": "No auth function available for given request", "error": "invalid_request"}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Aug 2021 16:17:05 GMT</pubDate>
    <dc:creator>nort99</dc:creator>
    <dc:date>2021-08-11T16:17:05Z</dc:date>
    <item>
      <title>Refresh token using dropbox-sdk-js returns 400 error</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Refresh-token-using-dropbox-sdk-js-returns-400-error/m-p/538793#M2072</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using&amp;nbsp;dropbox-sdk-js v10.5.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;let &lt;/SPAN&gt;&lt;SPAN&gt;dbx &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;Dropbox({&lt;BR /&gt;    &lt;SPAN&gt;clientId&lt;/SPAN&gt;: &lt;SPAN&gt;data&lt;/SPAN&gt;.dropbox.client_id,&lt;BR /&gt;    &lt;SPAN&gt;//accessToken: ACCESS_TOKEN,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;refreshToken&lt;/SPAN&gt;: &lt;SPAN&gt;data&lt;/SPAN&gt;.dropbox.refresh_token,&lt;BR /&gt;    &lt;SPAN&gt;fetch&lt;/SPAN&gt;: &lt;SPAN&gt;isoFetch&lt;/SPAN&gt;,&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see the logic in the library (&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/cc5136afe4df31284b29dde3933b4c7b72089086/src/auth.js#L348" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/cc5136afe4df31284b29dde3933b4c7b72089086/src/auth.js#L348&lt;/A&gt;) 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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;{"error_description": "No auth function available for given request", "error": "invalid_request"}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 16:17:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Refresh-token-using-dropbox-sdk-js-returns-400-error/m-p/538793#M2072</guid>
      <dc:creator>nort99</dc:creator>
      <dc:date>2021-08-11T16:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh token using dropbox-sdk-js returns 400 error</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Refresh-token-using-dropbox-sdk-js-returns-400-error/m-p/538798#M2074</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://github.com/dropbox/dropbox-sdk-js/issues/769" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-js/issues/769&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've followed up on your GitHub post.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 16:52:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Refresh-token-using-dropbox-sdk-js-returns-400-error/m-p/538798#M2074</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-08-11T16:52:17Z</dc:date>
    </item>
  </channel>
</rss>

