|
|
@ -32,10 +32,10 @@ function onRequest(context) {
|
|
|
|
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
|
|
|
|
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
|
|
|
|
var resp = tokenUtil.decode(encodedClientKeys).split(":");
|
|
|
|
var resp = tokenUtil.decode(encodedClientKeys).split(":");
|
|
|
|
var deviceParam = "{\"scope\":\"stats\",\"deviceIdentifiers\":[{\"id\":\"" + device.deviceIdentifier
|
|
|
|
var deviceParam = "{\"scope\":\"stats\",\"deviceIdentifiers\":[{\"id\":\"" + device.deviceIdentifier
|
|
|
|
+ " \", \"type\":\"" + device.type + "\"}]}";
|
|
|
|
+ "\", \"type\":\"" + device.type + "\"}]}";
|
|
|
|
var encodedScope = tokenUtil.encode(deviceParam);
|
|
|
|
var encodedScope = tokenUtil.encode(deviceParam);
|
|
|
|
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,
|
|
|
|
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default",
|
|
|
|
"{\"device\": \"" + encodedScope + "\"}");
|
|
|
|
{"device": encodedScope});
|
|
|
|
var token = "";
|
|
|
|
var token = "";
|
|
|
|
if (tokenPair) {
|
|
|
|
if (tokenPair) {
|
|
|
|
token = tokenPair.accessToken;
|
|
|
|
token = tokenPair.accessToken;
|
|
|
|