public void RefreshToken(UserInfo userInfo) { AuthApi apiInstance = new AuthApi(userInfo.ServerUrl); try { var refreshModel = apiInstance.RefreshToken(userInfo); userInfo.Token = refreshModel.Token; userInfo.RefreshToken = refreshModel.RefreshToken; } catch (Exception ex) { if (ex.Message != "One or more errors occurred.") { throw new InvalidOperationException("Exception when calling AuthApi.RefreshToken: " + ex.Message); } else { throw new InvalidOperationException(ex.InnerException.Message); } } }