Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
oscar2511
Partner - Contributor
Partner - Contributor

Qlik Engine JSON API - authentication

Hi, I need to get a list of the apps through an external development. I tried to do it with "Qlik Engine JSON API" using websockets in nodejs:

 

const WebSocket = require ('ws');

// Set certPath to the path to the directory that contains the exported client certificates in PEM format.
var certPath = path.join ('C:', 'ProgramData', 'Qlik', 'Sense', 'Repository', 'Exported Certificates', '.Local Certificates');

var certificates = {
cert: fs.readFileSync (path.resolve (certPath, 'client.pem')),
key: fs.readFileSync (path.resolve (certPath, 'client_key.pem')),
root: fs.readFileSync (path.resolve (certPath, 'root.pem'))
};

// Open a WebSocket using the engine port (rather than going through the proxy)
// We use the certificates and a built-in Qlik service account
// We connect at the global level, which gives access to APIs in the Global class

const ws = new WebSocket ('wss: //server.domain.com: 4747 / app /', {
ca: certificates.root,
cert: certificates.cert,
key: certificates.key,
headers: {
'X-Qlik-User': 'UserDirectory = internal; UserId = sa_engine '
}

});

ws.onopen = function (event) {
// send some message
}

 

The answer I get is:

{"jsonrpc": "2.0", "method": "OnAuthenticationInformation", "params": {"loginUri": "http: // my-qliksense-domain: 80 / internal_forms_authentication /? targetId = a5ee264a-8fa5-4303- 916d-a4ef7774d0b8 "," mustAuthenticate ": true}}

I am not sure how I should follow the authentication process.

Thanks

Labels (1)
0 Replies