I have a AuthorizationServer which uses password grant_type using Spring Security. I am using this for a mobile application. When a user enters their username and password to log in, the app calls the token endpoint and generates a token, if they are an authenticated user. This is all handled by password grant_type itself. For an unsuccessful login, it returns below general error with 400 HTTP status code.
{
"error": "invalid_grant",
"error_description": "Bad credentials"
}
For my scenario I need to customize this error message. Is their a way to change this error message?
I tried the suggested duplicate question: Customize authentication failure response in Spring Security using AuthenticationFailureHandler, but it uses the formLogin and it's not working with my implementation.