Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to establish a connection to the Qlik engine Websocket API. Referring here: https://help.qlik.com/en-US/sense-developer/August2021/Subsystems/EngineAPI/Content/Sense_EngineAPI/...
I am trying to connect to QlikSense Enterprise from my local computer, using the certificates method. I received the root.pem, client.pem and client_key.pem files from our Qliksense admin. But whenever I am trying to connect, I am receiving this error:
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)
at TLSSocket.emit (events.js:400:28)
at TLSSocket._finishInit (_tls_wrap.js:937:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12) {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
This is the nodejs script which I am using:
const WebSocket = require('ws'); const path = require('path') const fs = require('fs') // Set certPath to the path to the directory that contains the exported client certificates in PEM format. var certPath = path.join('/local-path-to-pem-files/'); 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-name>/app/', { ca: [certificates.root], cert: certificates.cert, key: certificates.key }); ws.onopen = function (event) { // send some message } ws.on('error', function(error) { console.log(error); });
Is there anything I am missing? Can someone please help?
Thanks
I guess you need to allow for self signed certificates. There's a thread on the topic for node.js here:
Thanks,
I saw there is another way to authenticate JSON API, ie, using API key. Will it solve the same purpose? Is this method available for Qliksense Enterprise?