<?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 Re: Unable to Retrieve a new short-lived access token through Javascript in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665987#M30147</link>
    <description>&lt;P&gt;That would change the "Content-Type" request header value that you send, but you need to also make sure the value you're sending in the body actually uses that format. That is, you should be formatting the parameters accordingly, not using JSON.stringify. For example, you may want to use URLSearchParams, or whatever functionality you prefer and have available for formatting the parameters accordingly.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2023 19:44:18 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2023-03-07T19:44:18Z</dc:date>
    <item>
      <title>Unable to Retrieve a new short-lived access token through Javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665972#M30144</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I followed the approach described in below post to get refresh token&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Get-refresh-token-from-access-token/td-p/596739" target="_blank" rel="noopener"&gt;https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Get-refresh-token-from-access-token/td-p/596739&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Through Javascript I am trying to get new short lived access token (step 7 in above post) using below code, but I am getting error as given below&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;--&amp;gt;&lt;FONT color="#FF6600"&gt;"error": "invalid_request", "error_description": "The request parameters do not match any of the supported authorization flows. Please refer to the API documentation for the correct parameters."&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I tried the same through Postman I am able to get the access token.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My javascript code is given below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;--------------------------------------------------------&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;SPAN&gt; tokobj &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;"refresh_token"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &amp;lt;My refresh token obtained using above approach&amp;gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;"grant_type"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"refresh_token"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;"client_id"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;&amp;lt;my app key&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;"client_secret"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;&amp;lt;my app secret&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;SPAN&gt; reftokendpoint &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;A href="https://api.dropbox.com/oauth2/token" target="_blank" rel="noopener"&gt;https://api.dropbox.com/oauth2/token&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;SPAN&gt; tokenOptions &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;method&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"POST"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;headers&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;"Content-Type"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"application/json"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;},&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;body&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;JSON&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;stringify&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;tokobj&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;const&lt;/SPAN&gt;&lt;SPAN&gt; tokenResults &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt;&lt;SPAN&gt; fetch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;reftokendpoint&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; tokenOptions&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;const&lt;/SPAN&gt;&lt;SPAN&gt; tokenPost &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;await&lt;/SPAN&gt;&lt;SPAN&gt; tokenResults&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Exec status'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; tokenPost&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT color="#FF00FF"&gt;&lt;SPAN&gt;------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest how this can be resolved&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 19:10:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665972#M30144</guid>
      <dc:creator>sr_c</dc:creator>
      <dc:date>2023-03-07T19:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Retrieve a new short-lived access token through Javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665980#M30145</link>
      <description>&lt;P&gt;The parameters for &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token" target="_blank"&gt;the /oauth2/token endpoint&lt;/A&gt; should be sent as 'application/x-www-form-urlencoded' POST parameters, not JSON. I see your code is sending them as JSON so the API does not receive them and so the operation fails with that error. Please update your code to send the parameters using the&amp;nbsp; 'application/x-www-form-urlencoded' format.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 19:26:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665980#M30145</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-03-07T19:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Retrieve a new short-lived access token through Javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665982#M30146</link>
      <description>&lt;P&gt;Hello &lt;SPAN class=""&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/10"&gt;@Greg-DB&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried with below, but the error remains same. Not sure where is the issue.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;headers&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Content-Type"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"application/x-www-form-urlencoded"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Mar 2023 19:40:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665982#M30146</guid>
      <dc:creator>sr_c</dc:creator>
      <dc:date>2023-03-07T19:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Retrieve a new short-lived access token through Javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665987#M30147</link>
      <description>&lt;P&gt;That would change the "Content-Type" request header value that you send, but you need to also make sure the value you're sending in the body actually uses that format. That is, you should be formatting the parameters accordingly, not using JSON.stringify. For example, you may want to use URLSearchParams, or whatever functionality you prefer and have available for formatting the parameters accordingly.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 19:44:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/665987#M30147</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-03-07T19:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Retrieve a new short-lived access token through Javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/666111#M30150</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/10"&gt;@Greg-DB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot. It solved my issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 07:25:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unable-to-Retrieve-a-new-short-lived-access-token-through/m-p/666111#M30150</guid>
      <dc:creator>sr_c</dc:creator>
      <dc:date>2023-03-08T07:25:11Z</dc:date>
    </item>
  </channel>
</rss>

