title: After hit the logout endpoint its showing "401 Unauthorized". Do you know why?
body: <p>I was doing some requests to an API using jwt and it was working fine. Then, I created a logout endpoint and did a POST request to this endpoint like &quot;http://app.test/api/logout/&quot;.</p>
  <p>It worked and it showed &quot;'Logout'&quot; according to the code below:</p>
  <pre><code>public function logout()
      {
          try {
              auth('api')-&gt;logout();
  
              return response()-&gt;json([
                  'msg' =&gt; 'Logout'
              ], 200);
          } catch (Exception $e) {
              return response()-&gt;json([
                  'error' =&gt; $e-&gt;getMessage()
              ]);
          }
      }
  }
  </code></pre>
  <p>Then I did a request again to the login endpoint to get a new jwt. However, now when I try to do requests to the other endpoints, that were working fine before the logout request like a get request to get all posts &quot;http://app.test/api/posts/&quot;, it shows always this error:</p>
  <pre><code>&quot;message&quot;: &quot;Wrong number of segments&quot;,
      &quot;exception&quot;: &quot;Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException&quot;,
  </code></pre>
  <p>The Api Routes are under the 'jwt.auth' middleware:</p>
  <pre><code>Route::post('login', [JwtController::class, 'login'])
  -&gt;name('login');
  
  Route::post('logout', [JwtController::class, 'logout'])
  -&gt;name('logout');
  
  Route::group(['middleware' =&gt; 'jwt.auth'], function () {
  ...
  }
  </code></pre>
  <p>If I remove from the headers the Accept key with application/json, it shows <code>401 not authorised</code> instead of the invalid number of segments.</p>
  <p>Do you know what can be the issue? Thanks!</p>