unify login, add_token and register