<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JWT authentication in mashup in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435152#M20286</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293732"&gt;@pdimitrakis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only suspicious thing I see is that you are missing "kid" (keyid) in the JWT header, my header looks like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "c4xxxxxxxxxxx72"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Mar 2024 11:56:20 GMT</pubDate>
    <dc:creator>Damien_V</dc:creator>
    <dc:date>2024-03-27T11:56:20Z</dc:date>
    <item>
      <title>JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435032#M20279</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We are trying to login our html mashup to Qlik Cloud using JWT auth.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We have already setup the JWT identity provider in the Qlik management console.&lt;BR /&gt;The JWT token is created using a php library and send for authorisation using the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    var config = {
        host: 'qwxxxxxxxxxxxxxx.eu.qlikcloud.com',
        prefix: '/',
        port: 443,
        isSecure: true,
        webIntegrationId: 'xxxxxxxxxx', // from qlik management console
        jwt: "eyJhb....UA", //token created using the php library
    };    
	
	async function login() {
        function isLoggedIn() {
            console.log("checking logged in");
            return fetch("https://" + config.host + "/api/v1/users/me", {
                method: 'GET',
                mode: 'cors',
                credentials: 'include',
                headers: {
                    'Content-Type': 'application/json',
                    'qlik-web-integration-id': config.webIntegrationId
                },
            }).then((response) =&amp;gt; {
                return (response.status === 200);
            });
        }

        return isLoggedIn().then((loggedIn) =&amp;gt; {
            if (!loggedIn) {
                console.log("not logged in");
                return fetch("https://" + config.host + "/login/jwt-session", {
                    method: 'POST',
                    mode: 'cors',
                    credentials: 'include',
                    headers: {
                        'Content-Type': 'application/json',
                        'qlik-web-integration-id': config.webIntegrationId,
                        'Authorization': 'Bearer ' + config.jwt,
                    },
                }).then((response) =&amp;gt; {
                    if (response.status !== 200) {
                        console.log("failed logged in");
                        throw new Error('failed to login via jwt');
                    }
                });
            } else {
                console.log("already logged in");
            }
        });
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The response we get from the request is the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "errors": [
        {
            "title": "Authentication failed",
            "detail": "No identity-provider is able to complete the exchange",
            "code": "LOGIN-1",
            "status": "401"
        }
    ],
    "traceId": "9cf4f041f5b6aa685eca85cce00075c3"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The JWT token is valid and properly decoded. We tested it by removing the "nbf" from the payload and the response mentioned that the nbf was missing.&lt;BR /&gt;&lt;BR /&gt;Any thoughts what can be the problem?&lt;BR /&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 08:20:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435032#M20279</guid>
      <dc:creator>pdimitrakis</dc:creator>
      <dc:date>2024-03-27T08:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435036#M20280</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293732"&gt;@pdimitrakis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share the exact content (structure) of your JWT token?&lt;BR /&gt;You can use the debugger on jwt.io to get it.&lt;/P&gt;
&lt;P&gt;Please mask any sensitive information.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 08:30:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435036#M20280</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2024-03-27T08:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435053#M20282</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;JWT header
{
  "typ": "JWT",
  "alg": "RS256",
  "jti": "67xxxxxxxxxxx6f",
  "issuer": "qwxxxxxxxxx.eu.qlikcloud.com",
  "iss": "qwxxxxxxxxx.eu.qlikcloud.com"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;JWT payload

{
  "jti": "67xxxxxxxxxxxxxxxxxxxxxxxxx6f",
  "iss": "qwxxxxxxxxxxx.eu.qlikcloud.com",
  "aud": "qlik.api/login/jwt-session",
  "sub": "64xxxxxxxxxxc",
  "subType": "user",
  "iat": 1711529073,
  "nbf": 1711529073,
  "exp": 1711532673,
  "userId": "64xxxxxxxxxxc",
  "name": "Panagiotis Dimitrakis",
  "email": "xxxxxxxxxx",
  "email_verified": true,
  "roles": [
    "RootAdmin"
  ]
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Some information is duplicate as the names of the payload fields were found different is other responses regarding the payload.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 08:49:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435053#M20282</guid>
      <dc:creator>pdimitrakis</dc:creator>
      <dc:date>2024-03-27T08:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435152#M20286</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/293732"&gt;@pdimitrakis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only suspicious thing I see is that you are missing "kid" (keyid) in the JWT header, my header looks like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "c4xxxxxxxxxxx72"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 11:56:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435152#M20286</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2024-03-27T11:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: JWT authentication in mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435434#M20298</link>
      <description>&lt;P&gt;You were right &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks a lot.&lt;BR /&gt;&lt;BR /&gt;Just for the reference, after the login worked I tried cleaning the JWT token headers and payload and the minimum working set is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;headers
{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "2xxxxxxxxb"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;payload

{
  "jti": 1711610797, //random unique, i.e timestamp
  "iss": "qxxxxxxxxxx8.eu.qlikcloud.com",
  "aud": "qlik.api/login/jwt-session",
  "sub": "6xxxxxxxxxxxxxxc", //the user id
  "subType": "user",
  "iat": 1711610797,
  "nbf": 1711610797,
  "exp": 1711614397,
  "name": "John Doe",
  "email": "xxxxxxxx@xxxxxxxx.com",
  "email_verified": true
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 10:20:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435434#M20298</guid>
      <dc:creator>pdimitrakis</dc:creator>
      <dc:date>2024-03-28T10:20:45Z</dc:date>
    </item>
  </channel>
</rss>

