I realize my title is a bit vague, but here is my situation. I have just started an application in which I am implementing JWT for authentication. I have my server side se
Make sure that there is a trailing slash at the end of the route you are calling. So instead of calling
'http://localhost:5000/auth'
you target
'http://localhost:5000/auth/'
Hope this helps.
It looks like you're having problems with a cross origin request.
The page host (localhost:4200
) is different than the destination (localhost:5000
).
When that happens chrome issues a preflighted request:
Unlike simple requests (discussed above), "preflighted" requests first send an HTTP request by the OPTIONS method to the resource on the other domain, in order to determine whether the actual request is safe to send. Cross-site requests are preflighted like this since they may have implications to user data.
The response you get from there server doesn't include the needed CORS headers, and therefor chrome doesn't issue the actual POST
request.
As mentioned Chrome issues preflighted request. To bypass that you could install this Chrome extension to enable CORS and add *'Allow-Control-Allow-Origin: ' to your headers. That worked for me with django on localhost:8000 and angular2 on localhost:4200.