简体   繁体   English

LOOPBACK中的模型

[英]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. 我创建了我的第一个回送项目和模型名称,并在启动该项目后将其作为注释提供给我,该项目在本地主机上创建了一个名为user的模型(但我没有创建),还找到了登录注销方法,但不知道的工作方式,当我尝试使用它时说“需要授权”,因为我是LOOPBACK的新手,我需要您的帮助。

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

Probably you created a Loopback project with authentication. 可能您创建了具有身份验证的Loopback项目。 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. 另外,您还需要一个与accessToken相关的表。 Since you aren't sending the auth token, then its response is 401 (authorization required). 由于您没有发送auth令牌,因此其响应为401(需要授权)。

See https://docs.strongloop.com/display/public/LB/Introduction+to+User+model+authentication for more information. 有关更多信息,请参见https://docs.strongloop.com/display/public/LB/Introduction+to+User+model+authentication

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM