Welcome Guest, Not a member yet? Register   Sign In
CI4 Filter before method throw for page unauthorized
#1

I'm able to filter request to my rest api using ci4 filter.
But the problem is, I dont understand how to throw the error for showing page unauthorized like in http message.

PHP Code:
class Authorization implements FilterInterface {
  public function before(RequestInterface $request){
    $token $request->getServer('HTTP_AUTHORIZATION')
    if($token == null){
      // How can I send the response that showing unauthorized 401?
      // 
    }
  }

Reply


Messages In This Thread
CI4 Filter before method throw for page unauthorized - by 404NotFound - 04-09-2020, 06:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB