set_response($output, REST_Controller::HTTP_OK); } /** * URL: http://localhost/CodeIgniter-JWT-Sample/authtimeout/token * Method: POST * Header Key: Authorization * Value: Auth token generated in GET call */ public function token_post() { $headers = $this->input->request_headers(); if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) { //TODO: Change 'token_timeout' in application\config\jwt.php $decodedToken = AUTHORIZATION::validateTimestamp($headers['Authorization']); // return response if token is valid if ($decodedToken != false) { $this->set_response($decodedToken, REST_Controller::HTTP_OK); return; } } $this->set_response("Unauthorised", REST_Controller::HTTP_UNAUTHORIZED); } }