Re: 401 Unauthorized with Hello-world example


Originally posted by on 2013-04-24 21:06:14

Hi Hervé,

it seems you are having an issue with the same origin policy of your browser, see"> That policy enforces that REST requests issued from a web page can only go to the same server that the web page came from.

If you are developing on your PC, your web page is coming from localhost, whereas the request goes to So the browser will reject the request.

To still be able to develop on your PC, you have three options.
* Put your browser into development mode. You can launch Chrome with the argument "–disable-web-security".
* Use the Eclipse SDK. The SDK comes with a proxy servlet that passes everything send to localhost/apis to the Cumulocity server. This is described in "Run the application" in the "Hello, world!" example.
* If you don't use Eclipse or the SDK, use another proxy. There are some available. One of our developers uses a Grunt task for this.

What we have currently on the roadmap is support for CORS ("> … ce_Sharing), which will allow you to simply develop without any of the above workarounds by configuring your tenant to allow CORS to you.

Maybe the above discussion deserve a section in the docs … :-/

Have more questions? Submit a request