OAuth Rest API v2 - getting data from the DB
Aldevinas Katkus
4-4-18
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?
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
Piotr Wycichowski
This is not the issue of upgrade SERP. But serverip.dat in this case contains the value: 192.168.88.12:1301, so this is local IP of the server with SERP. Anyway I don't understand what do you me...
15:30 14 Jan 2025
Brittany McGrath
reply ...
05:10 14 Jan 2025