Skip to Content
0

SAP HCP IOT Post Data is returning 401 Authorization Error

Feb 05 at 11:49 AM

102

avatar image

Hi,

I'm Working on SAP IoT services and trying to consuming in SAPUI5.

I have used the below code to post data using IoT plugin.

var oAuth = "Bearer oAuthCode";
 var message = [{
	  	"location":""+lat+" N,"+lon+" E"
	  }];
var sDeviceId = "00000000-0000-000f00000-94f094f03100";
	  var sMessageTypeId = "00000000000000000000";
	  var seconds =  new Date().getTime();

IOT.postData(sDeviceId,"sync",sMessageTypeId,message,
	  function(result){
	  	sap.m.MessageToast.show("Message sent: "+result);
	  },
	  function(error){
	    sap.m.MessageToast.show("Message Error : "+error.responseText);
	  },
	  {
         headers: {
                "Authorization":oAuth 
        }});

The status code is shown as 401 unauthorized.

Please help me on this.

Thanks and Regards,

Prabhu M.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anton Levin
Feb 05 at 12:42 PM
0

Please, see similar thread [1] and the answer by Former Member who suggests to re-check destination settings.

Regards,

Anton

[1] https://answers.sap.com/questions/185527/unable-to-connect-iot-message-management-service-t.html

Share
10 |10000 characters needed characters left characters exceeded