/** * Authenticate request with Basic. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Routing\Route $route * @return mixed */ public function authenticate(Request $request, Route $route) { $this->validateAuthorizationHeader($request); if ($response = $this->auth->onceBasic($this->identifier) and $response->getStatusCode() === 401) { throw new UnauthorizedHttpException('Basic', 'Invalid authentication credentials.'); } return $this->auth->user(); }