Service function for user authentication