Concrete5 rest api does not work

Permalink 1 user found helpful
I do as in the video and receive:
{
"error": "access_denied",
"message": "The resource owner or authorization server denied the request.",
"hint": "Missing \"Authorization\" header"
}

GEThttp://concrete5.dariuszgarus.pl/index.php/ccm/api/v1/system/info?a...

In the second case

POST
https://concrete5.dariuszgarus.pl/oauth/2.0/authorize...

unsupported_grant_type

The authorization grant type is not supported by the authorization server.

dariuszgarus
 
hutman replied on at Permalink Reply
hutman
Are you using cURL to make these requests?

You need to add the required parameters to the post/get requests.
dariuszgarus replied on at Permalink Reply
dariuszgarus
Hi. Thanks for reply.
I used postman and cURL.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "http://concrete5.dariuszgarus.pl/index.php/ccm/api/v1/system/info?access_token=example_token",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Accept: */*",
    "Accept-Encoding: gzip, deflate",
    "Cache-Control: no-cache",
    "Connection: keep-alive",
hutman replied on at Permalink Reply
hutman
Take a look at the video on this page https://documentation.concrete5.org/developers/rest-api/connecting-t... and fast forward to about 5:35, he talks about this exact error.
dariuszgarus replied on at Permalink Best Answer Reply
dariuszgarus
Hutman thanks but that's not it.
PHP HTTP AUTHORIZATION HEADER was disabled

This solves the problem

.htaccess

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
.