octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
816 stars 182 forks source link

PUT /devices/uuid giving error as {"error":"unauthorized"} #47

Closed nkjindal111 closed 10 years ago

nkjindal111 commented 10 years ago

I am trying to update the values as curl -X PUT -d "token=123&des=new+description" http://localhost:3000/devices/e5d63c01-d768-11e3-ae29-0793735fa4f9 But it gives me error saying unauthorized. Please help me.

octoblu commented 10 years ago

We updated our security permissions this weekend and haven't updated the docs. Try:

curl -X PUT -d "des=new+description" http://localhost:3000/devices/e5d63c01-d768-11e3-ae29-0793735fa4f9?token=123

nkjindal111 commented 10 years ago

Thanks for your reply... Now its working.

nkjindal111 commented 10 years ago

Hi, I have tried to update the value of "online=true" as curl -X PUT -d "online=true" http://localhost:3000/devices/e5d63c01-d768-11e3-ae29-0793735fa4f9?token=123 it got updated but if I again want to set the "online value to false" it gives me the same error saying unauthorized why it is giving this error?.....help please

nkjindal111 commented 10 years ago

And also I am trying to delete the device after update ....first it shows that device unregistered but when i query again to show all devices it still shows the device in the list

octoblu commented 10 years ago

We really need to make these APIs RESTful again :(

Here's how you currently need to do it:

curl -X PUT -d "online=true&uuid=e5d63c01-d768-11e3-ae29-0793735fa4f9" http://localhost:3000/devices/e5d63c01-d768-11e3-ae29-0793735fa4f9?token=123

and

curl -X DELETE -d "uuid=e5d63c01-d768-11e3-ae29-0793735fa4f9" http://localhost:3000/devices/e5d63c01-d768-11e3-ae29-0793735fa4f9?token=123

nkjindal111 commented 10 years ago

Thanks for reply but sorry to say still its not working. one time I am able to update but if I want to update again then it gives me same error as "unauthorized" And also with delete if I update the device once then I am not able to delete the device....on console it shows device unregistered but when I query again for all devices then the device still remains. Without updating the device I am able to delete the device.

monteslu commented 10 years ago

@nkjindal111 I'm currently updating the api and docs now to explain the security mechanisms. Should have something soon.

monteslu commented 10 years ago

@nkjindal111 The docs on the skynet.im are updated. You don't need to pass a token as part of the query string, but it does need to be a header now.