Hi i have a spring configuration xml file for OAuth2. I have configured it in such a way as to require the parameters and effect called curl to request the token.It makes requests such as:
curl -X POST -v http://localhost:8080/oauth/token -d "grant_type=password&client_id=test&client_secret=test&username=user1&password=password1"
I wish if prompted the token with username and password wrong, it was generated a json custom error. How can I do?
Thanks
If you want to add additional information impliment a custom "OAuthTokenEnhancer" class from "TokenEnhancer". and in the enhance method you can add your additional information.
If you want to return a custom error, You may use custom exception in your custom "AuthenticationProvider" ("authenticate" method), like: