Skip to main content
Announcements
Talend Data Catalog 8.0 End of Support: December 31, 2024 Get Details

Qlik Sense: How to set up JWT authentication

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_V
Support
Support

Qlik Sense: How to set up JWT authentication

Last Update:

Nov 21, 2022 7:05:02 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jun 3, 2017 4:03:15 AM

This article explains how to simply set up JWT authentication using Qlik Sense default certificates and test it.

 

Click here for Video Transcript

 

Steps:

  1. Create a new virtual proxy

    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" as well as Qlik Sense For Administrators - JWT authentication for details.

    1. In the authentication section, select JWT for authentication
    2. Paste the certificate used to sign/decrypt JWT in "JWT certificate

      In this article, we will use the default Qlik Sense certificate located:

      Important note: We use Qlik Default certificates for simplicity in this article, in a Production scenario, the customer should create the key material (generate a private/public key pair for JWT signing and verification) that is managed by customer internal security policies.

    3. Go to C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates
    4. Open server.pem in a text editor
    5. Copy the content including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- then paste it in the JWT Certificate field in the QMC > Virtual Proxy configuration.
    6. 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.
    7. Apply changes and close.
       

      setup of the jwt certificate in a virtual token.png



  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.

    1. Open https://jwt.io and go to the debugger
    2. Select RS256 for the algorithm
    3. In the PAYLOAD box, set up your attributes previously set via QMA in Qlik Sense's virtual proxy configuration for the user ID and the user directory. (Note: Swap 'DOMAIN' with the user's directory) 
    4. 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
    5. You can now copy the JWT generated in the left field and test it. This should look like:

      encoded jwt.png

  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.

    1. Install ModHeader from the Chrome Web Store
    2. Try to go to the hub:

                https://{your server name}/{prefix for JWT virtual proxy}/hub/

    3. You should get a 401 error: "Could not authenticate the request: Expected an authentication header." as no header has been provided.
    4. Go to ModHeader and set the following header:

             Header name: Authorization
             Header value: Bearer yourjwt

      request headers.png

    5.    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.

Related Content:

Labels (1)
Comments
Sonja_Bauernfeind
Digital Support
Digital Support

Hello @MattiasThalén 

An encrypted JWT does not equal HTTPs. HTTPS is traffic encryption, which does not rely on an encrypted JWT (which you cannot use in this instance). I recommend you post about what you are trying to achieve (your requirements) in our Integration forum, where our active userbase and support agents can assist you better.

All the best,
Sonja 

Kartik2
Partner - Creator
Partner - Creator

I have added  a virtual proxy using JWT method ,  i verified the public and private keys using jwt.io and created a token.
I then used Fiddler classic decryped https and added Authorization and Bearer <token generated from jwt.io>  it shows succes  but after using this link -
 https://{your server name}/{prefix for JWT virtual proxy}/hub/     i got error 401 

Then I used chrome extension Modheader added the name as "Authorization" and value as "Bearer <token generated from jwt.io> "  and this worked the site was opening 

But when i pause modheader and restart my chrome browser and try to open the link it again shows error 401 
I gave this link to other users who didn't had Modheader extension and they also get error 401 

Any Solution??

 

 

aldosilva6
Contributor II
Contributor II

How can I use jwks_uri instead of JWT certificate? The only format available is .pem?

chrisbrain
Partner - Specialist II
Partner - Specialist II

Should these JWTs not have some sort of expiry?

mbj
Employee
Employee
Yes, on the latest qlik.dev post you will find those attributes
rchuta1
Partner - Contributor
Partner - Contributor

Please, how can I get the user ID and the user directory?, thanks

Version history
Last update:
‎2022-11-21 07:05 AM
Updated by: