ng-token-auth
ng-token-auth copied to clipboard
Requests sent by $auth send parameters as text/plain
I just began using this package yesterday and I can't seem to get my login requests to be received correctly. I am using Angular 1.6 on the front-end with an ExpressJS backend.
The code I'm sending the request with:
$auth.submitLogin(vm.loginCreds)
.then((response) => {
$log.log('Success', response)
}, (response) => {
$log.log('Failure', response)
})
Here is the request that is sent as well as the response:
The thing that I notice is that the parameters are there, but the Content-Type
is text/plain
. I would expect a normal $http
request to be sent using application/json
.
To add to this, whenever the request gets to my server, the parameters are non-existent. I am using a top-level middleware in Express to print out all requests that come through and the body of the request that comes in has: req.body == {}
. I think this is because the server is meant to accept JSON parameters, but the requests are leaving the browser in plain text, however I am not certain that this is the issue.
Any thoughts on this would be much appreciated.
All the best, Tresky