I'm currently working on python to Qlik server connection using JWT authentication method. It works fine for some 3 or 4 requests and then it shows error. I don't know what is wrong with it.
Also, I heard that try to use certificate authentication. but I don't know how to use it with WebSocket. (please provide demo code if possible)
please note that I cannot use a cookie to hold the session with Qlik server because my application is itself Django server and it cannot store a cookie.
below is my python code for authentication.
def __init__(self, senseHost, proxyPrefix, userDirectory, userId, privateKeyPath, ignoreCertErrors=False):
self.url = "wss://" + senseHost + "/" + proxyPrefix + "/app/"
privateKey = open(privateKeyPath).read()
sslOpts = {}
if ignoreCertErrors:
sslOpts = {"cert_reqs": ssl.CERT_NONE}
token = jwt.encode({'UserID': userId, 'UserDirectory': userDirectory}, privateKey, algorithm='RS256')
self.ws = create_connection(self.url, sslopt=sslOpts, header=['Authorization: BEARER ' + token.decode('utf-8')])
self.session = self.ws.recv()
Any help!
Thanks,
Bhargav Patel