Problem/Motivation
Using BASIC_AUTH as user-1
curl --verbose --request GET 'http://admin:admin@drupal.d8/node?_format=json'
curl --verbose --request GET 'http://admin:admin@drupal.d8/node?_format=hal_json'
HTTP/1.1 403 Forbidden
fails while
curl --verbose --request GET 'http://drupal.d8/node/1?_format=json'
curl --verbose --request GET 'http://drupal.d8/node/1?_format=hal_json'
According to #5 token is required for a basic auth requests for authenticated users only.
Note: similar report on rest export display but different solution in #2228141: Add authentication support to REST views
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
I'm running basic tests on Drupal 8's REST server... Doing simple GET on nodes...
basic auth doesnt work on a resource with cookie auth enabled. are they meant to be mutually exclusive?
are there any instances where a client may want both? this wont work because if cookie enabled, basic auth is ignored.
Comments
Comment #1
Syntapse commentedComment #2
Syntapse commentedComment #3
Syntapse commentedComment #4
dawehnerCan you have a quick look at the generated route entry. Does it have just basic auth or also cookie in there?
Comment #5
clemens.tolboomI can get a node without problems using BASIC_AUTH using
but adding a Rest export display to /node both gives
while without authentication both result in expected JSON response
Debugging my angular app configured to use BASIC_AUTH I discovered StackMiddleware starts a session which is later on used by CSRFAccessCheck to require a token for authenticated users only.
Comment #6
dawehnerThis issue is certainly not suitable for base system
Comment #7
clemens.tolboomComment #8
dawehnerI'm curious whether #2228141: Add authentication support to REST views would sort of fix the issue?
Comment #9
clemens.tolboomI've tested #2228141: Add authentication support to REST views again and it's patch solve requests like
So this is a duplicated of mentioned issue.