CI4 Filter before method throw for page unauthorized |
Hello,
I use HTTP Responses to manage my response. For example, if my website has a maintenance mode activated, I will send this : $this->response->setStatusCode(503); $this->response->setHeader('Retry-After', '3600'); $this->response->setBody('<h1>Maintenance mode activated.</h1>'); return $this->response->send(); You can have more informations about this at this page : https://codeigniter4.github.io/userguide...ponse.html Also, for REST API, I think you can use API Response Trait : https://codeigniter4.github.io/userguide...onses.html I never used API Response, but you can use something like that : return $this->respond($data, 401, $description); OR return $this->failUnauthorized($description); Hope this help you ! |
Messages In This Thread |
CI4 Filter before method throw for page unauthorized - by 404NotFound - 04-09-2020, 06:53 PM
RE: CI4 Filter before method throw for page unauthorized - by jean5769 - 04-09-2020, 11:05 PM
RE: CI4 Filter before method throw for page unauthorized - by 404NotFound - 04-10-2020, 02:57 AM
RE: CI4 Filter before method throw for page unauthorized - by jean5769 - 04-10-2020, 05:23 AM
RE: CI4 Filter before method throw for page unauthorized - by kilishan - 04-10-2020, 07:04 AM
RE: CI4 Filter before method throw for page unauthorized - by 404NotFound - 04-10-2020, 08:37 AM
RE: CI4 Filter before method throw for page unauthorized - by kmp8072 - 12-15-2020, 07:56 AM
|