1
votes

I am using Loopback 3 and my datasource is MySQl. I have created a user with SUPER_ADMIN role. The entries in the table look like below:

The user table looks like below:

1   admin   password [email protected]

The Role table looks like below:

3   ADMIN   super admin 4/24/18 11:42 AM    4/24/18 11:42 AM

The Rolemapping table

4   ADMIN   1   3

But when I try use this role in the ACL, it does not work:

{
  "accessType": "*",
  "principalType": "ROLE",
  "principalId": "ADMIN",
  "permission": "ALLOW",
  "property": "greet"
}

The above always throws 401, Authorization Required error.

Could anyone let me know, if I am missing anything here.

Thanks

1
post your debug strings loopback.io/doc/en/lb2/Setting-debug-strings.html - user8120138

1 Answers

1
votes

principalType value is wrong in the RoleMapping entry, ADMIN should be replaced with USER, which is a constant here: app.models.RoleMapping.USER