1

I am using Rest web service . I CREATED a view called ART and specified its path (/viewpath) and I set the http baisc authentication within that view's structure such that the results will be accessible only for a user whose role is RESTADMIN . Everything works fine when I curl using the path of that view and the username and password of the user (of role restadmin) :

curl http://username:password@example.com/viewpath

However , when I try to get a simple article using its nid :

curl http://example.com/node/2?_format=hal_json 

I get no results and "The used authentication method is not allowed on this route" . Even when I put the username and password as before I still get this error. I do realize that the authentication I have set is just for the view ART. But I can't find the solution to let the other link work any idea why?

1 Answer 1

0

Since the latter uses hal_json, you need to do it like this

curl --request GET --user myusername:mypassword --header 'Accept: application/hal+json' \
http://example.com/node/2?_format=hal_json

For more info, see Using other authentication protocols.

1
  • thankkk youu !!
    – Jasmin
    Oct 9, 2020 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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