added authorization error handling to search