Fixed new credentials not being set due to return happening before asynchronous operation completed