0

I'm having a model called companyUsers when I make a GET request I get all the companyUsers data. But when I make a DELETE or PUT request I get 401 (Unauthorized) error.

I made a DELETE request by method provided by loopback-angularjs-sdk like this

BaseUser.companyUser.destroy({
    id:recruiterId
});

please guide me into this.

Sparsh Pipley
  • 451
  • 8
  • 22
  • You need to check the server side code. Also, improve your question. I cannot know what is wrong if you cant provide the code that handles your DELETE / PUT request. – callmekatootie Sep 07 '15 at 06:25
  • @callmekatootie i've updated the code please help me into this. – Sparsh Pipley Sep 07 '15 at 06:51
  • Think about it yourself. Just by looking at the above code, can I really make out what is wrong? As mentioned, the issue lies on the server side. Paste the entire code - right from the request handler to the controller / model functions that respond to your request. – callmekatootie Sep 07 '15 at 07:05
  • 1
    Check your ACL. https://docs.strongloop.com/display/public/LB/Controlling+data+access Try using destroyById or deleteById from angularjs sdk. I am not sure that destroy method is provided. – A.Z. Sep 07 '15 at 07:08
  • 1
    As stated by the rest of the people here, can you provide a link to a test project on GitHub? See https://github.com/strongloop/loopback/wiki/Reporting-issues#bug-report – superkhau Sep 08 '15 at 22:13

1 Answers1

0

This is caused mainly due to the permission setting of the model. Try giving all the permissions to owner and see if you can delete.

Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48