jeudi 18 août 2016

Loopback Login a user with REST as datasource

I have a UserModel that has a base model USER and a REST datasource

"UserModel": { "dataSource": "mock", "public": true } 

Data Source

"mock": { "name": "mock", "baseURL": "http://localhost:3000/", "connector": "rest" }, 

The UserModel

{ "name": "UserModel", "base": "User", "idInjection": true, "options": { "validateUpsert": true }, "properties": {}, "validations": [], "relations": {}, "acls": [], "methods": {} } 

The problem when I call /UserModel/login with a post and a body like

{"username": "test", "password": "123"}

in the mock server I only get a call without even the password to:

/UserModels?where%5Busername%5D=test&limit=1&offset=0&skip=0

I want to handle the login through REST and a backend that receives the Username and password check for them and return 200 or 401

Aucun commentaire:

Enregistrer un commentaire