refactoring to return json for mobile auth request