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
Reino Botha
Please check your version of android if it is the same as the server you are connecting too. ...
08:24 21 Nov 2024
Bror-Erik Kotiranta
In NC you hace operations>>ai chats. They are used for these Br, Bror-Erik...
05:12 21 Nov 2024