diff --git a/src/Middleware/AuthenticationServerMiddleware.php b/src/Middleware/AuthenticationServerMiddleware.php index 2d5ffe41..83f3f1c5 100644 --- a/src/Middleware/AuthenticationServerMiddleware.php +++ b/src/Middleware/AuthenticationServerMiddleware.php @@ -34,7 +34,7 @@ class AuthenticationServerMiddleware public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { try { - $response = $this->server->respondToRequest($request, $response); + $response = $this->server->respondToAccessTokenRequest($request, $response); } catch (OAuthServerException $exception) { return $exception->generateHttpResponse($response); // @codeCoverageIgnoreStart diff --git a/src/Server.php b/src/Server.php index 3513d642..ba18ce91 100644 --- a/src/Server.php +++ b/src/Server.php @@ -139,7 +139,7 @@ class Server implements EmitterAwareInterface $tokenResponse = null; while ($tokenResponse === null && $grantType = array_shift($this->enabledGrantTypes)) { /** @var \League\OAuth2\Server\Grant\GrantTypeInterface $grantType */ - if ($grantType->canRespondToRequest($request)) { + if ($grantType->canRespondToAccessTokenRequest($request)) { $tokenResponse = $grantType->respondToRequest( $request, $this->getResponseType(),