api: add support to login, logout and editing