on 2016 Aug 04 11:08 AM
Hi,
after building an App which uses the IoT services from the HANATRIAL platform (using the IoT.js methods) , we want to convert this web-app into a mobile hybrid app. The App sends IoT data using the oAuth token of a certain device configuartion to simulate a IoT device and works well as deployed on the HANAtrial.
The corresponding app was build by use of the HAT (1.17.2) and successfully registered to the mobile services via Kapsel logon plugin.
Unfortunately the services are not working, i.e. there seems to be no connection to the HANA trial IoT services.
We were trying different approaches to configure the backend destination in the app customizing on the trial landscape mobile services ( e.g. user http://iotmms/http/api where iotmms is the destination from HANA cloud trial platform which works with the deployed WebApp).
However every setting resulted in either "not found" or "403 no authorization" when trying to ping the destination.
What might be the destination setting working for this scenario ? Or do we need to change the WebApp to make the oAuth connection ?
Request clarification before answering.
Hi Marcus,
Actually you do NOT need configure any backend connections. When you inject the IOT.js, it already injected the direct service URL in.
Pls check and make sure you have some lines in your IOT.js like below:
if(location.protocol !== "https:") {
setServiceUrl(
"https://iotrdmsx36737db5-XXXX.neo.ondemand.com/com.sap.iotservices.dms/api/",
"https://iotmmsXXXX.neo.ondemand.com/com.sap.iotservices.mms/v1/api/http/");
}
And if you want to invoke any API on the device, you have to provide Authorization header, either Basic or OAuth. like below example:
IOT.getDeviceTypes(function(res){
console.log(JSON.stringify(res, null, 4));
}, function() {
MessageToast.show("Error");
}, {
headers: {
"Authorization": "Basic " + btoa("<username>:<password>")
}
});
or
//...
headers: {
"Authorization": "Bearer " + oAuthToken
}
//...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, the XXXX should be the actual HANA account name.
you don't need change anything manually. It will replace the 2 URLs automatically, before inject iot.js into your project,
you just need make sure correct Authorization header is supplied. Then the app could be build awith HAT and connect to the IOT service.
Regards,
YaoSheng
Hi Sheng,
sorry for bothering again.
after injection I see something like :
https://iotmmsxbafd2b25.neo.ondemand.com/com.sap.iotservices.mms/v1/api/http
should it not look like
https://iotmmss000myuseridtrial.neo.ondemand.com/com.sap.iotservices.mms/v1/api/http/
User | Count |
---|---|
53 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.