From bfe4197678b66e76af99f61e1612666d965d680f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Gallego?= Date: Sat, 1 Aug 2015 10:26:34 +0200 Subject: [PATCH] Less strict HTTP code check --- src/Server/AuthorizationServer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Server/AuthorizationServer.php b/src/Server/AuthorizationServer.php index a5d8637..d9a86c8 100644 --- a/src/Server/AuthorizationServer.php +++ b/src/Server/AuthorizationServer.php @@ -193,7 +193,9 @@ public function handleAuthorizationRequest(ServerRequestInterface $request, Toke $event = new AuthorizationCodeEvent($request, $response, $owner); $event->setTarget($this); - if ($response->getStatusCode() === 200) { + $statusCode = $response->getStatusCode(); + + if ($statusCode >= 200 && $statusCode <= 399) { $this->getEventManager()->trigger(AuthorizationCodeEvent::EVENT_CODE_CREATED, $event); } else { $this->getEventManager()->trigger(AuthorizationCodeEvent::EVENT_CODE_FAILED, $event); @@ -237,7 +239,9 @@ public function handleTokenRequest(ServerRequestInterface $request, TokenOwnerIn $event = new TokenEvent($request, $response, $owner); $event->setTarget($this); - if ($response->getStatusCode() === 200) { + $statusCode = $response->getStatusCode(); + + if ($statusCode >= 200 && $statusCode <= 399) { $this->getEventManager()->trigger(TokenEvent::EVENT_TOKEN_CREATED, $event); } else { $this->getEventManager()->trigger(TokenEvent::EVENT_TOKEN_FAILED, $event);