diff --git a/src/Grant/AbstractGrant.php b/src/Grant/AbstractGrant.php index 2949327ce..e9796b185 100644 --- a/src/Grant/AbstractGrant.php +++ b/src/Grant/AbstractGrant.php @@ -158,7 +158,6 @@ protected function validateClient(ServerRequestInterface $request): ClientEntity throw OAuthServerException::invalidClient($request); } - $client = $this->getClientEntityOrFail($clientId, $request); // If a redirect URI is provided ensure it matches what is pre-registered diff --git a/tests/Grant/DeviceCodeGrantTest.php b/tests/Grant/DeviceCodeGrantTest.php index 3cabffb2d..3169f0896 100644 --- a/tests/Grant/DeviceCodeGrantTest.php +++ b/tests/Grant/DeviceCodeGrantTest.php @@ -458,6 +458,7 @@ public function testRespondToRequestMissingDeviceCode(): void $client->setIdentifier('foo'); $clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock(); $clientRepositoryMock->method('getClientEntity')->willReturn($client); + $clientRepositoryMock->method('validateClient')->willReturn(true); $refreshTokenRepositoryMock = $this->getMockBuilder(RefreshTokenRepositoryInterface::class)->getMock(); $refreshTokenRepositoryMock->method('persistNewRefreshToken')->willReturnSelf(); @@ -492,9 +493,8 @@ public function testRespondToRequestMissingDeviceCode(): void $responseType = new StubResponseType(); - // TODO: We need to be more specific with this exception - // We should add an error that says the device code is missing perhaps? $this->expectException(OAuthServerException::class); + $this->expectExceptionCode(3); $grant->respondToAccessTokenRequest($serverRequest, $responseType, new DateInterval('PT5M')); }