cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
1,134

Hello,

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: https://blogs.sap.com/2016/04/10/communicate-with-iot-in-your-webide-project/

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,

Garrett

View Entire Topic
0 Kudos

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