Hi,
If the bug is as shown in this answer, but you want to stay in 5.2.x, there is a detail description on how I fixed that in CAS 5.2.x in the PR, a bit dirty but should do the trick.
If your bug is not the same as what I describe above, then idk how to help you, just so you know after fixing the above bug listed in the PR, CAS OAuth runs completely fine in both 5.2.x and 5.3.x version for me.
Cheers!
- Andy