Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

balaji_m
New Contributor II

how to generate Xrfkey in qlik sense

Hello,

I am trying to access REST API using Postman so i have to pass  Xrfkey key.I dont' know how to get this key.Please refer the link for your reference.

awaiting for your help.

https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositorySe...

Thanks in advance.

Regards,

Balaji

6 Replies
Not applicable

Re: how to generate Xrfkey in qlik sense

The xrfkey needs to be 16 characters long and should contain normal characters :

var X-Qlik-Xrfkey = '0MwkYLXpxHrbkKGu'


and depending on what api call you're making example : 'session/' + profile.SessionId + '?xrfkey=' + xrfkey;

balaji_m
New Contributor II

Re: how to generate Xrfkey in qlik sense

Hello Markus,

Thanks for your reply.

shall we give static Xrfkey  or it should be generated one from Qlik Sense.

If it is generated one then please let me know the procedure to generate the Xrfkey.

Can you please clarify this.

Regards,

Balaji

Employee
Employee

Re: how to generate Xrfkey in qlik sense

Hi Balaji,

You can put any 16 characters string as you like. What is really important is to put exactly the same string I both parameters. X-Qlik-Xrfkay in the request header and Xfrkay in the query string.

You want to do this for a "protection" against those who can contact the server pretending to be you.

Not applicable

Re: how to generate Xrfkey in qlik sense

You can use a static string which full fill the requirement, which are already stated above or create a function to generate a new key within each request (no neccessary)

But this is a string which you add to your request.

Also as stated in the docs, the xrfkey param has to match the x-Qlik-Xrfkey..

example generator from qlik-auth node module::

function generateXrfkey() {

        size = 16;

        chars = 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789';

        var rnd = crypto.randomBytes(size), value = new Array(size), len = chars.length;

             for (var i = 0; i < size; i++) {

                 value = chars[rnd % len]

             };

        return value.join('');

    },

balaji_m
New Contributor II

Re: how to generate Xrfkey in qlik sense

Thanks Vincenzo.

your are correct.

Regards,

Balaji

balaji_m
New Contributor II

Re: how to generate Xrfkey in qlik sense

Hello Markus,


Thanks for your help.

Regards,

Balaji

Community Browser