Skip to content

Commit

Permalink
Respond with helpful and spec complient error on invalid user credent…
Browse files Browse the repository at this point in the history
…ials
  • Loading branch information
marc-mabe committed May 21, 2021
1 parent b1ca467 commit 2d12fe7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Exception/OAuthServerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static function invalidScope($scope, $redirectUri = null)
*/
public static function invalidCredentials()
{
return new static('The user credentials were incorrect.', 6, 'invalid_credentials', 401);
return new static('The user credentials were incorrect.', 6, 'invalid_grant', 400);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Grant/PasswordGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function validateUser(ServerRequestInterface $request, ClientEntityInt
if ($user instanceof UserEntityInterface === false) {
$this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request));

throw OAuthServerException::invalidGrant();
throw OAuthServerException::invalidCredentials();
}

return $user;
Expand Down

0 comments on commit 2d12fe7

Please sign in to comment.