How to return 400 errors in checkAuth function?