Closed suederade closed 7 years ago
Hi @stevenmwade , thanks for reaching out! Can you show us how you're making a POST to /login
? If the request prefers text/html, you'll get a 404 from this endpoint when it's configured to only produce json.
@robertjd I am making the POST with Postman and setting the content-type to appplication/json
, but I can try with plain text.
Which doesn't make any change.
I have a user set up from some other stormpath tests and I am sending it this:
{
"username": "tk421@stormpath.com",
"password": "Changeme1"
}
Can you look at the Accept
header that postman is sending on the request? The Accept header is the header that a client uses to tell the server which content type it wants the response to be in. The Content-Type header is declaring the format of the data that is being sent to the server.
Connection →keep-alive
Content-Length →19
Content-Type →text/html; charset=utf-8
Date →Wed, 14 Dec 2016 19:53:43 GMT
X-Content-Type-Options →nosniff
X-Powered-By →Express
It looks like you need to add Accept: application/json
to the request.
@robertjd Nailed it. I'm surprised Postman isn't setting those itself. Thank you sir.
No prob, happy to help! I actually think we should handle this better on our side, we should infer the lack of an Accept header to mean you want the only configured response type.
The docs say:
And inside the Login section it then says:
I have the very simple application:
And when I make a post to the server I get this error:
Cannot POST /login
As far as I can see from the docs, there doesn't seem to be anything in my code that is incorrect.