title: JWT decode() must be of the type array error
body: <p>Here I have some slim PHP code which is log in and a function to check whether it decode the JWT that store in the header. </p>
  
  <pre><code>$app-&gt;post('/login', function ($request, $response) {
  
  $input = $request-&gt;getParsedBody();
  $settings = $this-&gt;get('settings'); // get settings array.
  $sql = "SELECT id, password FROM users WHERE id= :id";
  $sth = $this-&gt;db-&gt;prepare($sql);
  $sth-&gt;bindParam("id", $input['id']);
  $sth-&gt;execute();
  $user = $sth-&gt;fetchObject();
  
  // verify user id 
  if(!$user) {
      return $this-&gt;response-&gt;withJson(['error' =&gt; true, 'message' =&gt; 'NO ID '], 404)-&gt;withHeader('Content-type', 'application/json;charset=utf-8', 404);
  }
  // Compare the input password and the password from database for a validation
  if (strcmp($input['password'],$user-&gt;password)) {
      return $this-&gt;response-&gt;withJson(['error' =&gt; true, 'message' =&gt; 'These credentials do not match our records.'], 404)-&gt;withHeader('Content-type', 'application/json;charset=utf-8', 404);  
  }
  
  $payload = array(
      "iat" =&gt; time(),
      "exp" =&gt; time() + 36000,
      // "id" =&gt; $input['id']
      "context" =&gt; [
          "user" =&gt; [
              "id" =&gt; $input['id']
          ]
      ]
  );
  
  try {
      $token = JWT::encode($payload, $settings['jwt']['secret'],"HS256"); // $token store the token of the user
  } catch (Exception $e) {
      echo json_encode($e);
  }
  
  
  return $this-&gt;response-&gt;withJson($payload,200)
                        -&gt;withHeader('Content-type', 'application/json;charset=utf-8', 200)
                        -&gt;withAddedHeader('Authorization', $token);
  });
  
  
  $app-&gt;get('/get', function ($request, $response) {
  
  $jwt = $request-&gt;getHeader("Authorization"); 
  $settings = $this-&gt;get('settings'); 
  
  $token = JWT::decode($jwt, $settings['jwt']['secret'], "HS256"); // $token store the token of the user
  
  if ($token) {
      return $this-&gt;response-&gt;withJson($token, 200)
      -&gt;withHeader('Content-type', 'application/json;charset=utf-8', 200);
  }
  
  return $this-&gt;response-&gt;withJson($token,401)
                        -&gt;withHeader('Content-type', 'application/json;charset=utf-8', 401);
  
  });
  </code></pre>
  
  <p>But it when i try to run <a href="http://localhost:8080/get" rel="nofollow noreferrer">http://localhost:8080/get</a> it returns an error which is </p>
  
  <blockquote>
    <p>Argument 3 passed to Firebase\JWT\JWT::decode() must be of the type array. </p>
  </blockquote>
  
  <p>Why does it happen and how can i fix it?</p>