Move login api calls to session factory