<?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: header array invalid request for token auth php in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399877#M21893</link>
    <description>&lt;P&gt;When using "Basic" authorization, your "Authorization" header value should start with the string "Basic ". So, that line should look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;	"Authorization: Basic " . base64_encode($app_key . ":" . $app_secret),
&lt;/PRE&gt;
&lt;P&gt;Also, note that the /oauth2/token endpoint is based on the OAuth spec and doesn't work like the other Dropbox API endpoints. Specifically, it doesn't take a "Dropbox-API-Arg" header. You should be specifiy those parameters as 'application/x-www-form-urlencoded' POST parameters, not JSON in a header or body.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Feb 2020 22:14:20 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-02-28T22:14:20Z</dc:date>
    <item>
      <title>header array invalid request for token auth php</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399872#M21890</link>
      <description>&lt;P&gt;I have been trying to get the header array for my php curl working. This is the structure of it.&lt;/P&gt;
&lt;PRE&gt;$http_headers = array(
	"Authorization: " . base64_encode($app_key . ":" . $app_secret),
	"Content-Type: application/x-www-form-urlencoded",
	"Dropbox-API-Arg: " . json_encode(array(
	'code' =&amp;gt; $code,
	'grant_type' =&amp;gt; 'authorization_code',
	'redirect_url' =&amp;gt; 'http://localhost:8080/FSUInnovation/ResumeUpload.php'	
)));&lt;/PRE&gt;
&lt;P&gt;I get this error:&lt;/P&gt;
&lt;P&gt;{"error_description": "No auth function available for given request", "error": "invalid_request"}400&lt;/P&gt;
&lt;P&gt;I don't know what particular syntax issue is causing a problem for this particular request. I tried to base it off of my curl for file upload and download.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 07:02:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399872#M21890</guid>
      <dc:creator>FSUInnovation</dc:creator>
      <dc:date>2020-03-02T07:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: header array invalid request for token auth php</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399877#M21893</link>
      <description>&lt;P&gt;When using "Basic" authorization, your "Authorization" header value should start with the string "Basic ". So, that line should look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;	"Authorization: Basic " . base64_encode($app_key . ":" . $app_secret),
&lt;/PRE&gt;
&lt;P&gt;Also, note that the /oauth2/token endpoint is based on the OAuth spec and doesn't work like the other Dropbox API endpoints. Specifically, it doesn't take a "Dropbox-API-Arg" header. You should be specifiy those parameters as 'application/x-www-form-urlencoded' POST parameters, not JSON in a header or body.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 22:14:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399877#M21893</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-02-28T22:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: header array invalid request for token auth php</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399884#M21894</link>
      <description>&lt;P&gt;Do the other parameters need to be in a assosiative array appended to the Content Type element like I would do with the API Args, or do I need to post those parameters like this: "code: " . $code, ... ?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 22:36:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399884#M21894</guid>
      <dc:creator>FSUInnovation</dc:creator>
      <dc:date>2020-02-28T22:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: header array invalid request for token auth php</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399887#M21895</link>
      <description>&lt;P&gt;You should send them as POST parameters, encoded using "application/x-www-form-urlencoded", not headers. Here's a basic example I just put together for calling /oauth2/token using curl in PHP:&lt;/P&gt;
&lt;PRE&gt;$app_key = "&amp;lt;APP_KEY&amp;gt;";
$app_secret = "&amp;lt;APP_SECRET&amp;gt;";

$headers = array("Authorization: Basic " . base64_encode($app_key . ":" . $app_secret),
                 "Content-Type: application/x-www-form-urlencoded");

$authorization_code = "&amp;lt;AUTHORIZATION_CODE&amp;gt;";
$redirect_uri = "&amp;lt;REDIRECT_URI&amp;gt;";

$params = array("code" =&amp;gt; $authorization_code,
                "grant_type" =&amp;gt; "authorization_code",
                "redirect_uri" =&amp;gt; $redirect_uri);

$ch = curl_init('https://api.dropboxapi.com/oauth2/token');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

echo $response;
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}

curl_close($ch);&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Feb 2020 00:09:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/header-array-invalid-request-for-token-auth-php/m-p/399887#M21895</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-02-29T00:09:31Z</dc:date>
    </item>
  </channel>
</rss>

