Improved error handling in loginAsync

It a no network connection scenario, JSON deserialization fails when trying to access data, which is nil