Qlik Sense: How to set up JWT authenticationArticle Number: 000034966 | Last Modified: 2019/10/23
- Qlik Sense June 2017 and later
This section only explains settings specific to JWT and supposes that you have set up Name, Prefix, Session cookie header name, load balancing nodes and linked a Proxy to the new virtual proxy.
These are the minimum settings required for a virtual proxy to work correctly. Please refer to the Qlik Sense Online Help "Creating a virtual proxy" for details.
- In the authentication section, select JWT authentication
- Paste the certificate used to sign/decrypt JWT in "JWT certificate
- Go to C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates
- Open server.pem in a text editor
- Copy the content including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- then paste it in the "JWT Certificate" field in the QMC
- Choose a value for "JWT attribute for user ID" and "JWT attribute for user directory". That can be anything (except reserved key words for JWT claims) but it must match the values used in the JWT payload section when the JWT is generated.
- Apply changes and close.
2. Generate the JWT
In this article, we will directly use the JWT debugger available on https://jwt.io to generate the token. In a real use case, the JWT library corresponding to the programming language used should be used to generate the JWT.
- Open https://jwt.io and go to the debugger
- Select RS256 for the algorithm
- In the payload, set up your attributes previously set in the virtual proxy for the user ID and the user directory
- In the Verify signature, paste server.pem (Certificate) and server_key.pem (Private key) content in the appropriate fields. Those files are both located in C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates
- You can now copy the JWT generated in the left field and test it. This should look like:
3. Test the generated JWT
In order to log in with JWT, you need to inject the JWT as a header. There are various extensions available depending on your browser in order to test this.
In this example, we are using Chrome with Modheader.
- Install ModHeader from the Chrome Web Store
- Try to go to the hub:
- You should get a 401 error: "Could not authenticate the request: Expected an authentication header." as no header has been provided.
- Go to ModHeader and set the following header:
Header value: Bearer yourjwt
- Reload the page, you should now be logged into the hub correctly.
In order to integrate your solution with Qlik Sense using JWT authentication, you will need to pass in your code the JWT token in the authorization token for the first request to Qlik Sense so that a session is created.
Some examples of integration for different purposes are available on the internet:
Have a Question?
Search Qlik's Support Knowledge database or request assisted support for highly complex issues.Submit a case
Experiencing a serious issue, please contact us by phone. View phone numbers and hours by region.