Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I did not quite understood very well the authentication process. If there is anybody that has a clear vision on this i would be gratefull.
After creating the virtual proxy, generate certificate i'm running the node index.js command from command prompt.
var qsocks = require('qsocks');
var fs = require('fs');
var request = require('request');
var r = request.defaults({
rejectUnauthorized: false,
host: 'win-v9un77su0bn',
pfx: fs.readFileSync('client.pfx')
})
// Authenticate whatever user you want
var b = JSON.stringify({
"UserDirectory": 'win-v9un77su0bn',
"UserId": 'demouser',
"Attributes": []
});
// Get ticket for user - refer to the QPS API documentation for more information on different authentication methods.
r.post({
uri: 'https://win-v9un77su0bn:4243/qps/vp/ticket?xrfkey=abcdefghijklmnop',
body: b,
headers: {
'x-qlik-xrfkey': 'abcdefghijklmnop',
'content-type': 'application/json'
}
},
function(err, res, body) {
// Consume ticket, set cookie response in our upgrade header against the proxy.
var ticket = JSON.parse(body)['Ticket'];
r.get('https://win-v9un77su0bn/vp/hub/?qlikTicket=' + ticket, function(error, response, body) {
var cookies = response.headers['set-cookie'];
// qsocks config, merges into standard https/http object headers.
// Set the session cookie correctly.
// The origin specified needs an entry in the Whitelist for the virtual proxy to allow websocket communication.
var config = {
host: 'win-v9un77su0bn',
isSecure: true,
origin: 'http://localhost',
rejectUnauthorized: false,
headers: {
"Content-Type": "application/json",
"Cookie": cookies[0]
}
}
console.log('User ticket: ' + ticket)
})
});
The ticket is successfully generated, but when i try to access in browser a file containing code from a mashup, i am still required to authenticate.Is this normal? i would presume that once the ticket was generated the user would be automatically connected and i could display the chart objects.