<?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: Error in call to API function &amp;quot;auth/token/from_oauth1&amp;quot;: Bad HTTP &amp;quot;Content-Type&amp;amp;qu in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-in-call-to-API-function-quot-auth-token-from-oauth1-quot/m-p/279909#M16811</link>
    <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/50795358/error-in-call-to-api-function-auth-token-from-oauth1-bad-http-content-type" target="_blank"&gt;https://stackoverflow.com/questions/50795358/error-in-call-to-api-function-auth-token-from-oauth1-bad-http-content-type&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message is indicating that your client is sending up an unexpected Content-Type value (using a&amp;nbsp;boundary), when it needs to be using one of the listed expected values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This appears to be happening because you're just&amp;nbsp;sending the POST fields directly. You need to sending JSON though, so you would put your&amp;nbsp;CURLOPT_POSTFIELDS array inside json_encode().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, note that t&lt;SPAN&gt;his endpoint is only meant for use if you already have pre-existing OAuth 1 access tokens.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;If you don't have pre-existing OAuth 1 access tokens, you should send the user through the normal OAuth 2 app authorization flow.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;You can find information on how that works in the OAuth guide here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/reference/oauth-guide" rel="noreferrer" target="_blank"&gt;https://www.dropbox.com/developers/reference/oauth-guide&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation for the OAuth 2 app authorization flow can be found here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#authorization" rel="noreferrer" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#authorization&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 15:57:06 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2018-06-11T15:57:06Z</dc:date>
    <item>
      <title>Error in call to API function "auth/token/from_oauth1": Bad HTTP "Content-Type" header: "application</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-in-call-to-API-function-quot-auth-token-from-oauth1-quot/m-p/279827#M16800</link>
      <description>&lt;P&gt;i am calling app auth api&amp;nbsp;but i am receiving below error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error in call to API function "auth/token/from_oauth1": Bad HTTP "Content-Type" header: "application/json; boundary=------------------------796cea680fa095ca". Expecting one of "application/json", "application/json; charset=utf-8", "text/plain; charset=dropbox-cors-hack".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Code&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;$ch &lt;/SPAN&gt;= curl_init();&lt;BR /&gt;curl_setopt(&lt;SPAN&gt;$ch&lt;/SPAN&gt;, CURLOPT_URL, &lt;SPAN&gt;"https://api.dropboxapi.com/2/auth/token/from_oauth1"&lt;/SPAN&gt;);&lt;BR /&gt;curl_setopt(&lt;SPAN&gt;$ch&lt;/SPAN&gt;, CURLOPT_CUSTOMREQUEST, &lt;SPAN&gt;'POST'&lt;/SPAN&gt;);&lt;BR /&gt;curl_setopt(&lt;SPAN&gt;$ch&lt;/SPAN&gt;, CURLOPT_RETURNTRANSFER, &lt;SPAN&gt;true&lt;/SPAN&gt;);&lt;BR /&gt;curl_setopt(&lt;SPAN&gt;$ch&lt;/SPAN&gt;, CURLOPT_HTTPHEADER, &lt;SPAN&gt;array&lt;/SPAN&gt;(&lt;BR /&gt;    &lt;SPAN&gt;'Content-Type: application/json'&lt;/SPAN&gt;,&lt;BR /&gt;    &lt;SPAN&gt;'Authorization: Basic bmF0dWdweTsdwqegzbnE1MDFs4OnFiN3F3an3p3anpkdGJzOA=='&lt;BR /&gt;&lt;/SPAN&gt;));&lt;BR /&gt;curl_setopt(&lt;SPAN&gt;$ch&lt;/SPAN&gt;, CURLOPT_POSTFIELDS, &lt;SPAN&gt;array&lt;/SPAN&gt;(&lt;BR /&gt;    &lt;SPAN&gt;'oauth1_token' &lt;/SPAN&gt;=&amp;gt; &lt;SPAN&gt;'natugpy83123nq5sdf01l'&lt;/SPAN&gt;,&lt;BR /&gt;    &lt;SPAN&gt;'oauth1_token_secret' &lt;/SPAN&gt;=&amp;gt; &lt;SPAN&gt;'qb7qwjsdfzwjzdtfbs8'&lt;/SPAN&gt;,&lt;BR /&gt;));&lt;BR /&gt;&lt;SPAN&gt;$result &lt;/SPAN&gt;= curl_exec(&lt;SPAN&gt;$ch&lt;/SPAN&gt;);&lt;BR /&gt;curl_close(&lt;SPAN&gt;$ch&lt;/SPAN&gt;);&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:12:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-in-call-to-API-function-quot-auth-token-from-oauth1-quot/m-p/279827#M16800</guid>
      <dc:creator>umairali</dc:creator>
      <dc:date>2019-05-29T09:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Error in call to API function "auth/token/from_oauth1": Bad HTTP "Content-Type&amp;qu</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-in-call-to-API-function-quot-auth-token-from-oauth1-quot/m-p/279909#M16811</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/50795358/error-in-call-to-api-function-auth-token-from-oauth1-bad-http-content-type" target="_blank"&gt;https://stackoverflow.com/questions/50795358/error-in-call-to-api-function-auth-token-from-oauth1-bad-http-content-type&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message is indicating that your client is sending up an unexpected Content-Type value (using a&amp;nbsp;boundary), when it needs to be using one of the listed expected values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This appears to be happening because you're just&amp;nbsp;sending the POST fields directly. You need to sending JSON though, so you would put your&amp;nbsp;CURLOPT_POSTFIELDS array inside json_encode().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, note that t&lt;SPAN&gt;his endpoint is only meant for use if you already have pre-existing OAuth 1 access tokens.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;If you don't have pre-existing OAuth 1 access tokens, you should send the user through the normal OAuth 2 app authorization flow.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;You can find information on how that works in the OAuth guide here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/reference/oauth-guide" rel="noreferrer" target="_blank"&gt;https://www.dropbox.com/developers/reference/oauth-guide&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation for the OAuth 2 app authorization flow can be found here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#authorization" rel="noreferrer" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#authorization&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 15:57:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-in-call-to-API-function-quot-auth-token-from-oauth1-quot/m-p/279909#M16811</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-06-11T15:57:06Z</dc:date>
    </item>
  </channel>
</rss>

