<?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: Get Access Token JavaScript in fetch in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735640#M3799</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ftbbQaW" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/42701i304A24BF65D6CE1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="ftbbQaW" alt="ftbbQaW" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The request parameters do not match any of the supported authorization flows. Please refer to the API documentation for the correct parameters.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but I don't understand why if I used all the parameters from the documentation. At the same time, if you do it in сURL, everything will work out well&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2023 18:11:52 GMT</pubDate>
    <dc:creator>Fomka_Wyverno</dc:creator>
    <dc:date>2023-12-08T18:11:52Z</dc:date>
    <item>
      <title>Get Access Token JavaScript in fetch</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735628#M3797</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;            const parameters = {
                'code': params.code,
                'grant_type': 'authorization_code',
                'redirect_uri': window.location.origin,
                'client_id': dataApp.client_id,
                'client_secret': dataApp.client_secret
            }


            console.log(parameters);

            fetch('https://api.dropbox.com/oauth2/token', {
                method: 'POST',
                body: JSON.stringify(parameters)
            }).then(response =&amp;gt; console.log(response))
                .catch(error =&amp;gt; console.log(`Error in POST: ${error}`));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;params.&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;code - this is code when i first redirect to my http in url parameters&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;window.&lt;/SPAN&gt;&lt;SPAN&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;origin - origin url my web-site&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;dataApp.&lt;/SPAN&gt;&lt;SPAN&gt;client_id - Api Key my application&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;dataApp.client_secret - App secret my application&lt;BR /&gt;But when fetching my response 400 - why?&lt;BR /&gt;&lt;BR /&gt;I looked at the curl convenerator in js suggested to do this&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;fetch('https://api.dropbox.com/oauth2/token', {
  method: 'POST',
  body: new URLSearchParams({
    'code': params.code,
    'grant_type': 'authorization_code',
    'redirect_uri':  window.location.origin,
    'client_id': dataApp.client_id,
    'client_secret': dataApp.client_secret
  })
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;But this again not work&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GHX7IlZ" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/42699iFC6B5090F5E733D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="GHX7IlZ" alt="GHX7IlZ" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zgqvlbw" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/42700i5CB2A60173AA971E/image-size/large?v=v2&amp;amp;px=999" role="button" title="zgqvlbw" alt="zgqvlbw" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Dec 2023 17:57:14 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735628#M3797</guid>
      <dc:creator>Fomka_Wyverno</dc:creator>
      <dc:date>2023-12-08T17:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get Access Token JavaScript in fetch</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735636#M3798</link>
      <description>&lt;P&gt;Check the contents of the response body for that error response. It should contain a more specific error message.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 18:06:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735636#M3798</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-12-08T18:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get Access Token JavaScript in fetch</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735640#M3799</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ftbbQaW" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/42701i304A24BF65D6CE1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="ftbbQaW" alt="ftbbQaW" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The request parameters do not match any of the supported authorization flows. Please refer to the API documentation for the correct parameters.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but I don't understand why if I used all the parameters from the documentation. At the same time, if you do it in сURL, everything will work out well&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 18:11:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735640#M3799</guid>
      <dc:creator>Fomka_Wyverno</dc:creator>
      <dc:date>2023-12-08T18:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get Access Token JavaScript in fetch</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735642#M3800</link>
      <description>&lt;P&gt;It looks like you're sending the parameters as JSON, but &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token" target="_blank"&gt;the /oauth2/token endpoint&lt;/A&gt; expects them as application/x-www-form-urlencoded POST parameters, and so your parameters aren't getting read. Update your implementation to send application/x-www-form-urlencoded POST parameters instead.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 18:19:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Get-Access-Token-JavaScript-in-fetch/m-p/735642#M3800</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-12-08T18:19:02Z</dc:date>
    </item>
  </channel>
</rss>

