diff --git a/src/Controller/OAuthController.php b/src/Controller/OAuthController.php index 9b771f9..0666fe7 100644 --- a/src/Controller/OAuthController.php +++ b/src/Controller/OAuthController.php @@ -80,16 +80,14 @@ class OAuthController public function getUserInfo() : IContent { - //TODO: headers should be set by soko-web - $headers = getallheaders(); - - if (!isset($headers['Authorization'])) { + $authorization = $this->request->header('Authorization'); + if ($authorization === null) { return new JsonContent([ 'error' => 'No Authorization header was sent.' ]); } - $accessToken = substr($headers['Authorization'], strlen('Bearer ')); + $accessToken = substr($authorization, strlen('Bearer ')); $token = $this->oAuthTokenRepository->getByAccessToken($accessToken); if ($token === null || $token->getExpiresDate() < new DateTime()) { diff --git a/web.php b/web.php index ebe80da..1d35292 100644 --- a/web.php +++ b/web.php @@ -86,6 +86,7 @@ Container::$request = new SokoWeb\Request\Request( $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, + getallheaders(), $_SESSION, new RVR\Repository\UserRepository() );