How to customer error bad credential oauth in spring boot?

Hi guy today I build project spring boot with oauth 2 protocol. My code is worke flow of oauth 2. But How Can I catch bad credential error when we put wrong client id and secrete in code? and onemore thing how can i get credential even it wrong or not?