Refator auth api