1

I am totally stuck here in Drupal 8 REST API, any help is very appriciate.

Problem:

I am using Drupal 8.3.x, simple_auth module to generate Auth token for REST. When I try to create user by Authorization Bearer then its not working but when I try to create by Basic Auth then it works fine. I also enabled permission for user REST.

See Permission for user resource: URL: admin/config/services/rest/resource/entity%3Auser/edit enter image description here

Postman Data:

Request header:
Authorization:Bearer token_value
Content-Type:application/hal+json
X-CSRF-TOKEN:OWp4RVNjlQbdjq-s6CMjNRIcfNiYsHp1L7Of87vJH2w

enter image description here

In Error Log:
League\OAuth2\Server\Exception\OAuthServerException: The resource owner or authorization server denied the request. in League\OAuth2\Server\Exception\OAuthServerException::accessDenied() (line 165 of /var/www/html/d8/drupal-8-composer/vendor/league/oauth2-server/src/Exception/OAuthServerException.php).

1 Answer 1

1

I resolved my problem by giving user creation permission to anonymous user. "Access POST on User registration resource"

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.