API login/logout method