<?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 suddenly stopped working (401 unauthorized) in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-suddenly-stopped-working-401-unauthorized/m-p/2469376#M20891</link>
    <description>&lt;P&gt;The problem was the setting of the following two parameters in the token.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Not before (nbf): identifies the starting time on which the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;JWT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is accepted.&lt;/LI&gt;
&lt;LI&gt;Issued at (iat): identifies the time at which the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;JWT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;was issued.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are creating the JWT token in PHP as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$the_time = time() - 10; (start time is before 10 seconds)

$exp_time = $the_time + 60 * 60; (expiration time is 60 minutes after the start)&lt;/LI-CODE&gt;
&lt;P&gt;and in the token:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;
{
"jti": 1720591311,
"iss": "issuer",
"aud": "qlik.api/login/jwt-session",
"sub": "6456c639a7ec9b1be923689c",
"subType": "user",
"iat": $the_time,
"nbf": $the_time,
"exp": $exp_time,
"name": "John Doe",
"email": "name@domain.com",
"email_verified": true
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem was in the 10 seconds setting.&lt;/P&gt;
&lt;P&gt;Setting the issue time and not before time to 5 minutes ago did the trick.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$the_time = time() - 300; (start time is before 300 seconds)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that somehow the Qlik tenant time got desynchronized over time since the original setting with the 10 seconds interval worked like a charm for 3 months.&lt;/P&gt;
&lt;P&gt;I hope my notes are useful to others.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2024 06:14:02 GMT</pubDate>
    <dc:creator>pdimitrakis</dc:creator>
    <dc:date>2024-07-10T06:14:02Z</dc:date>
    <item>
      <title>JWT suddenly stopped working (401 unauthorized)</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-suddenly-stopped-working-401-unauthorized/m-p/2469058#M20884</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;We have been using JWT authentication to access a mashup webpage since 03/2024.&lt;BR /&gt;&lt;BR /&gt;We needed some help then as seen in our question back then:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435434" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Integration-Extension-APIs/JWT-authentication-in-mashup/m-p/2435434&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ten days ago, the JWT authentication suddenly stopped working and all requests from various browsers and pc is the same:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "errors": [
        {
            "title": "Unauthorized",
            "code": "AUTH-1",
            "status": "401"
        }
    ],
    "traceId": "51a5bfec3f6a857bed9dc7fb96cc23a6"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We already tried recreating the key pair to test if that was the root of the problem, with no success.&lt;BR /&gt;&lt;BR /&gt;Any thoughts?&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 09:10:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-suddenly-stopped-working-401-unauthorized/m-p/2469058#M20884</guid>
      <dc:creator>pdimitrakis</dc:creator>
      <dc:date>2024-07-09T09:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: JWT suddenly stopped working (401 unauthorized)</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-suddenly-stopped-working-401-unauthorized/m-p/2469376#M20891</link>
      <description>&lt;P&gt;The problem was the setting of the following two parameters in the token.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Not before (nbf): identifies the starting time on which the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;JWT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is accepted.&lt;/LI&gt;
&lt;LI&gt;Issued at (iat): identifies the time at which the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;JWT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;was issued.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are creating the JWT token in PHP as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$the_time = time() - 10; (start time is before 10 seconds)

$exp_time = $the_time + 60 * 60; (expiration time is 60 minutes after the start)&lt;/LI-CODE&gt;
&lt;P&gt;and in the token:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;
{
"jti": 1720591311,
"iss": "issuer",
"aud": "qlik.api/login/jwt-session",
"sub": "6456c639a7ec9b1be923689c",
"subType": "user",
"iat": $the_time,
"nbf": $the_time,
"exp": $exp_time,
"name": "John Doe",
"email": "name@domain.com",
"email_verified": true
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem was in the 10 seconds setting.&lt;/P&gt;
&lt;P&gt;Setting the issue time and not before time to 5 minutes ago did the trick.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$the_time = time() - 300; (start time is before 300 seconds)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that somehow the Qlik tenant time got desynchronized over time since the original setting with the 10 seconds interval worked like a charm for 3 months.&lt;/P&gt;
&lt;P&gt;I hope my notes are useful to others.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 06:14:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/JWT-suddenly-stopped-working-401-unauthorized/m-p/2469376#M20891</guid>
      <dc:creator>pdimitrakis</dc:creator>
      <dc:date>2024-07-10T06:14:02Z</dc:date>
    </item>
  </channel>
</rss>

