I am trying to retreive an user cookie with an http-request with drupal. I am using:
When I POST: drupal-8-7-1.dd:8083/user/login?_format=json
with a body of {"name": "drupal", "pass": "drupal"}
, which contains account credentials.
I am expecting to retreive a 200 OK, a request cookie and a response object.
What happens however is that I get a 403 FORBIDDEN and a response object containing: {"message":"This route can only be accessed by anonymous users."}
.
I am however logged out as an user.
Any ideas on what is causing this and how to get the expected result?
If you are actually logged in, it's probably because a valid cookie from a previous session is still present in the request.
You can add/delete which cookies are to be sent along with the request, click on "Cookies" on the request pane (not be confused with the response cookie tab), see below :
Then just close the corresponding tab to delete the cookie :