Added an exception handler to the check_token endpoint

Returns error in json when requested

[Fixes #46310153]
Merge pull request #31 from joeldsa/develop

Added an exception handler to the check_token endpoint