added login functionality to API