环回 angular 401 需要授权
Loopback angular 401 Authorization Required
我正在开发带有环回和 angular 的应用程序。我用一些 addi 将环回中的 "user" 模态扩展为 "puser" 模态。字段('reportto')。
扩展模式的登录和注册工作正常
但是当我尝试使用方法"find"时,它显示需要 401 授权。
代码:
Puser.find({
filter : {
where : {
"reportto" : '639124805'
}
}
}, function(success) {
console.log(success);
}, function(error) {
console.log(error);
});
请查看屏幕截图以获取请求。 header。
有人可以帮忙吗?
默认情况下,loopback 保护 find
方法只能被所有者规则访问。
为了更改它,您必须覆盖模型配置 json。 (更多信息click here)
例如,要允许 public 访问所有方法,请添加以下 acl:
"acls": [
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
我正在开发带有环回和 angular 的应用程序。我用一些 addi 将环回中的 "user" 模态扩展为 "puser" 模态。字段('reportto')。
扩展模式的登录和注册工作正常
但是当我尝试使用方法"find"时,它显示需要 401 授权。
代码:
Puser.find({ filter : { where : { "reportto" : '639124805' } } }, function(success) { console.log(success); }, function(error) { console.log(error); });
请查看屏幕截图以获取请求。 header。
有人可以帮忙吗?
默认情况下,loopback 保护 find
方法只能被所有者规则访问。
为了更改它,您必须覆盖模型配置 json。 (更多信息click here)
例如,要允许 public 访问所有方法,请添加以下 acl:
"acls": [
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]