From 6ee958bbe73954ce536ceb3593e971d4f77b1c24 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 28 Sep 2016 11:03:46 +0530 Subject: [PATCH] Fixing JWT token issue for realtime analytics --- .../analytics-view.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js index b31a9caeef..92d60d83d1 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js @@ -32,10 +32,10 @@ function onRequest(context) { var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var resp = tokenUtil.decode(encodedClientKeys).split(":"); var deviceParam = "{\"scope\":\"stats\",\"deviceIdentifiers\":[{\"id\":\"" + device.deviceIdentifier - + " \", \"type\":\"" + device.type + "\"}]}"; + + "\", \"type\":\"" + device.type + "\"}]}"; var encodedScope = tokenUtil.encode(deviceParam); - var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username, - "{\"device\": \"" + encodedScope + "\"}"); + var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", + {"device": encodedScope}); var token = ""; if (tokenPair) { token = tokenPair.accessToken;