Changed function to authenticate and modified how the getUserRoles works on JavaScript - added test cases