How do I get a data from the DB when I have already authenticated via OAuth2 and got an access token?
I am getting an error "the resource is not allowed" when I am authorized and "not authorized to read this resource" when not authorized.
I have added "api" function to the "access functions from the web", but it did not help.
version 8.4 2017-12-09 (build 84191013)
According to OAuth docs , I should have to pass the access token in the request header
Authorization: Bearer
as described here https://tools.ietf.org/html/rfc6750#section-2
"Clients SHOULD make authenticated requests with a bearer token using
the "Authorization" request header field with the "Bearer" HTTP
authorization scheme. Resource servers MUST support this method."
php code:
...
if(session('access_token'))
$headers[] = 'Authorization: Bearer ' . session('access_token');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$err = curl_error($ch);
...
Any help?