Open peterminetree opened 3 years ago
function generateDeviceToken() {
var rands = []
for (var i = 0; i < 16; i++) {
var r = Math.random();
var rand = 4294967296.0 * r;
var a = (parseInt(rand) >> ((3 & i) << 3)) & 255;
rands.push(a);
}
var hex = [];
for (var i = 0; i < 256; ++i) {
var a = convert(i + 256).substring(1);
hex.push(a);
}
var s = "";
for (var i = 0; i < 16; i++) {
s += hex[rands[i]]
if (i == 3 || i == 5 || i == 7 || i == 9) {
s += "-";
}
}
return s;
}
Is the token function I use that works. Then just put that into your secrets file, or if you are hardcoding it into your code for a POC. You want to run it, save that and then reuse the token every time you logon. If you regenerate every time its possible RH will disassociate your authentication and force you to do it again.
I see a device token needs to be passed in. Can you put me in the right direction as to how I'm supposed to generate one?