Move login api calls to session factory

mend

mend

mend