Return a JSON object after authentication and registration rather than a String, because a String is not valid JSON