Refactor new API sdk and log in