diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 3da0f2d6a..a102943c9 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -826,11 +826,6 @@ namespace ArchiSteamFarm { await LimitLoginRequestsAsync().ConfigureAwait(false); - if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) { - // In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required - TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false); - } - if (!force && (!KeepRunning || SteamClient.IsConnected)) { return; } @@ -1340,7 +1335,7 @@ namespace ArchiSteamFarm { } } - private void OnConnected(SteamClient.ConnectedCallback callback) { + private async void OnConnected(SteamClient.ConnectedCallback callback) { if (callback == null) { ArchiLogger.LogNullError(nameof(callback)); return; @@ -1393,6 +1388,11 @@ namespace ArchiSteamFarm { loginKey = CryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey); } + if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) { + // In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required + TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false); + } + SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails { AuthCode = AuthCode, CellID = Program.GlobalDatabase.CellID,