Refactored auth apis