Skip to content

Commit 2d12fe7

Browse files
committed
Respond with helpful and spec complient error on invalid user credentials
1 parent b1ca467 commit 2d12fe7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Exception/OAuthServerException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static function invalidScope($scope, $redirectUri = null)
189189
*/
190190
public static function invalidCredentials()
191191
{
192-
return new static('The user credentials were incorrect.', 6, 'invalid_credentials', 401);
192+
return new static('The user credentials were incorrect.', 6, 'invalid_grant', 400);
193193
}
194194

195195
/**

src/Grant/PasswordGrant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function validateUser(ServerRequestInterface $request, ClientEntityInt
106106
if ($user instanceof UserEntityInterface === false) {
107107
$this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request));
108108

109-
throw OAuthServerException::invalidGrant();
109+
throw OAuthServerException::invalidCredentials();
110110
}
111111

112112
return $user;

0 commit comments

Comments
 (0)