2
votes

I'm facing issue, my model named Provider and i called a GET method it shows :

{
  "error": {
    "name": "Error",
    "status": 401,
    "message": "Authorization Required",
    "statusCode": 401,
    "code": "AUTHORIZATION_REQUIRED",
    "stack": "Error: Authorization Required\n    at /home/developer/node_modules/loopback/lib/application.js:396:21\n    at /home/developer/node_modules/loopback/lib/model.js:322:7\n    at /home/developer/node_modules/loopback/common/models/acl.js:472:23\n    at /home/developer/node_modules/async/dist/async.js:3679:13\n    at /home/developer/node_modules/async/dist/async.js:952:25\n    at iteratorCallback (/home/developer/node_modules/async/dist/async.js:997:17)\n    at /home/developer/node_modules/async/dist/async.js:847:20\n    at /home/developer/node_modules/async/dist/async.js:3676:17\n    at /home/developer/node_modules/async/dist/async.js:339:31\n    at /home/developer/node_modules/loopback/common/models/acl.js:454:17\n    at /home/developer/node_modules/loopback/common/models/role.js:272:21\n    at /home/developer/node_modules/async-listener/glue.js:188:31\n    at _combinedTickCallback (internal/process/next_tick.js:67:7)\n    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)"
  }
}

I'm dealing with a client whose project was abandoned by the developer . since i'm new to LOOPBACK i was confused totally and so need your HELP very badly ...

Thanks in advance ...

1
I think you must provide further informations about your problem. The get methods and the code responsible for this error - Ediruth
You have to provide the accesstoken with each request. - Subburaj
frd what sort of info u need ??? @Ediruth since i'm not the original developer i can provide any resource that will help to solve this issue ... - sunilsmith
@Subburaj i have set the access_token at the top left text box and also i used postman and hit the URL with access token but still i got this same issue - sunilsmith

1 Answers

1
votes

Check your model common/models/Provider.json file

Add the specific method permission:

"acls": [
    {
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "ALLOW"
    }
]

This will make all your model methods public without any authentication, for more information about ACL, read the docs:

https://docs.strongloop.com/display/public/LB/Controlling+data+access