Why doesn't the authentication work? 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 &quot;The used authentication method is not allowed on this route&quot; . 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?
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.