title: Verify if Token JWT is valid
body: <p>I'm using the Slim Framework to develop the backend. But I can not find a way to compare the token generated by my login function:</p>
  
  <pre><code>public function login($request, $response){
      $key = $this-&gt;container['key'];
      $email = $request-&gt;getParsedBody()['email'];
      $senha = $this-&gt;salt . $request-&gt;getParsedBody()['senha'];
  
      $usuario = $this-&gt;em-&gt;getRepository(UsuarioEntity::class)-&gt;findOneBy(['email' =&gt; $email]);
  
      if(empty($usuario) || !password_verify($senha, $usuario-&gt;getSenha())) {
        return $response-&gt;withJson('Usuario sem permissão de acesso', 401);
      }
  
      $token = array(
        "session" =&gt; password_hash($usuario-&gt;getId() . 'f*u87', PASSWORD_BCRYPT),
        "id" =&gt; $usuario-&gt;getId(),
        "iat" =&gt; time(),
        "exp" =&gt; time() + (60 * 10)
      );
  
      $jwt = \Firebase\JWT\JWT::encode($token, $key);
      return $response-&gt;withJson($jwt, 200);
  }
  </code></pre>
  
  <p>On the front-end (React) I call a JS class that handles all requests. I get and store the token value, but I do not know how to use it to check if user is logged in or not</p>
  
  <p>Requisition.js</p>
  
  <pre><code>axiosPost(funcao,dados){
      //A AUTENTICAÇÃO VAI AQUI
      return axios.post(config.urlBase + funcao, dados);
  }
  
  setToken(token){
      this.token = token;
  }
  
  getToken(){
      return this.token;
  }
  </code></pre>
  
  <p>LoginEmpresa.js(React Component)</p>
  
  <pre><code>login(){
      var reqAxios = new Requisicoes();
      reqAxios.axiosPost('login',{ email: this.state.email, senha: this.state.senha }).then(res =&gt; {
        if(res.data){
          reqAxios.setToken(res.data);
        }else{
          [...]
        }
      })
  }
  </code></pre>
  
  <p>Thanks</p>