Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are you connecting to rh? #51

Open
peterminetree opened this issue Nov 20, 2020 · 1 comment
Open

How are you connecting to rh? #51

peterminetree opened this issue Nov 20, 2020 · 1 comment

Comments

@peterminetree
Copy link

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?

@andresrivero
Copy link

andresrivero commented Mar 3, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants