Search code examples
node.jsloopbackjsloopback

Models in LOOPBACK


I create my first loopback project and model name I gave it as notes after starting the project I found in the localhost a model named user been created (but I didn't create it) and also found login and logout methods but don't know how it's working, when I tried it said "authorization required" since I'm new to LOOPBACK I need your help.

{
"error": {
   "message" : "authorization required"
}
}

Solution

  • Probably you created a Loopback project with authentication. In this case, kind Loopback creates a auth structure for you, that by default search for a 'user' table. Also you need an related table for the accessToken. Since you aren't sending the auth token, then its response is 401 (authorization required).

    See https://docs.strongloop.com/display/public/LB/Introduction+to+User+model+authentication for more information.