Login via rest using Restangular

381 Views Asked by At

The senario is that I just want to do a simple login using

var test = {login: 'testuser', password: 'asd'};
Restangular.one('/auth/login').post(test);

it makes a request to "auth/login/[object%20Object]" and I get a 404?

using this code it works just fine:

xmlhttp.send('{"login":"testuser", "password":"asd"}’);

Any ideas?

2

There are 2 best solutions below

0
On

You can use customPOST(test) and the data should be passed appropriately.

0
On

The code was actually working.. error was in the API!