Updated checkForAuthentication to make it pass the tests