change function getAuthenticationError and generateToken to protected