app/Controllers/Auth/Auth.php
// Se revisa que el token sea valido
Se revisa que el token sea valido
Se revisa que el token sea valido
public function validateToken($token = null){
        if($token) {
            try {
                validateJWTFromRequest($token);
                $decode = validateJWT($token);
                $refreshToken = getSignedJWTForUser($decode->email);
                return $this->response->setJSON(["status" => "success","code" => 200,"message" => "Valid token","token" => $refreshToken]);
            } catch (\Exception $e) {
                 return $this->response->setJSON(["status" => "error","code" => 500,"message" => $e->getMessage()]);
            }
        }else{
            return $this->response->setJSON(["status" => "error","code" => 500,"message" => "Empty token"]);
        }
    }
public function validateToken ( $ token = null ) { if ( $ token ) { try { validateJWTFromRequest ( $ token ) ; $ decode = validateJWT ( $ token ) ; $ refreshToken = getSignedJWTForUser ( $ decode -> email ) ; return $ this -> response -> setJSON ( [ " status " => " success " , " code " => 200 , " message " => " Valid token " , " token " => $ refreshToken ] ) ; } catch ( \ Exception $ e ) { return $ this -> response -> setJSON ( [ " status " => " error " , " code " => 500 , " message " => $ e -> getMessage ( ) ] ) ; } } else { return $ this -> response -> setJSON ( [ " status " => " error " , " code " => 500 , " message " => " Empty token " ] ) ; } }
Se revisa que el token sea valido
Se revisa que el token sea valido
// sleep(5);