Skip to content

Instantly share code, notes, and snippets.

@nazrdogan
Last active July 5, 2017 20:53
Show Gist options
  • Save nazrdogan/d4a56d59eda8a62a6a354fb60f06745d to your computer and use it in GitHub Desktop.
Save nazrdogan/d4a56d59eda8a62a6a354fb60f06745d to your computer and use it in GitHub Desktop.
function GetAuth2Token(device) {
return new Promise(function(resolve, reject) {
QRC.setTargetIpAddress(device.ip, device.index);
QRC.getToken(vm.current_password ||'12345678', device.index).then(sucFn);
function sucFn(data) {
QRC.setTargetAuthToken(data.data.access_token);
resolve (data.data.access_token);
}
});
}
var access_token;
GetAuth2Token(vm.scannedDevices[i]).then(function(data){
access_token = data;
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment