Skip to Content
avatar image
Former Member

Unable to connect IoT Message Management Service to UI5 due to 401 Authorization Error


I'm currently attempting to connect the iotmms to a SAP UI5 Application template via the getData() method on a trial account. I'm just a student so I apologize if this issue is trivial. I was using this blog post as a reference:

The issue is the IOT.js getData() method keeps returning a 401 http authorization error in my UI5 application. However, the iotrdms portion using the IOT.js getDevices() works just fine (since that destination is set up correctly).

Here's what it returns when I fire the getData() method with a selected device from the list:

Here is the code in the WebIDE firing this method:

This is my neo-app.json file (set up exactly like the blog post did):

And here is my hcp destinations. Someone suggested the iotmms also needs to include /http at the end of its url but that just returns a http 404 instead of a 401.

I believe it's one of four issues:

  1. The iotmms hcp destination is set up incorrectly.
  2. My neo-app.json file destination is incorrect or there's a new way to set it up.
  3. the authorization header information is incorrect when communicating with getData(). I'm not even sure if the getData() method requires header information or not. I can't find an example anywhere that uses it.
  4. The url I'm attempting to GET from is incorrect.

Strangely enough, the pushData() method (which I assume is using the mms url) is working just fine with or without authorization.

I also updated the message management service and re-injected the IOT.js file but neither seemed to fix it. Someone also suggested turning off authorization on the hcp iotmms destination, but that didn't work either.

If anyone can point me in the right direction on how to fix this I would be incredibly grateful. If you need any other additional information in order to solve this, please let me know.

Thank you,


401errors.jpg (31.8 kB)
getfocuseditem.jpg (50.9 kB)
neoapp.jpg (24.6 kB)
capture.jpg (32.8 kB)
capture.jpg (57.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 02, 2017 at 05:40 AM

    regarding the iotmms destination and nea-app.json, if you have "http" in the destionation then you don't need "entryPath": "/http" in your neo-app.json. Otherwise, if you have "entryPath": "/http" in neo-app.json then you don't need "http" in your iotmms destination.

    And error code 401 means Unauthorized: Access is denied due to invalid credentials. Since you can get this error seems like your destination, neo-app.json and the GET url are all correct.

    so I suspect there is something wrong with your OAuth token. Pls make sure you generated the token correctly, and also make sure your iot service is configured as well.

    Pls refer to Configuring OAuth 2.0 for more details

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 31, 2017 at 07:59 AM

    I've the same issue using "postData". As I see in your screenshot, you have defined the "iotmms" destination with "BasicAuthentication" (and surely entered your HCP credentials here). I did the same and it did not work. The solution was to change this to "NoAuthentication". Otherwise the "Authorization" header with the device token you've created in your JS code is not passed to MMS but your HCP credentials.

    It seems that some functions of the MMS need the device token as authentication (like "postData" and "getData") and some need the HCP credentials (like "pushData"), because if you open a new browser session and enter 

    in the browser address line, you get the authentication popup where you can enter your HCP username/password, but if you enter 

    you directly get "Access to the requested resource is not authorized (HTTP 401)" because the Authorization header with the device token is missing.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 06, 2018 at 05:29 AM

    Is it solved?

    Add comment
    10|10000 characters needed characters exceeded