mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Add handling of AccessDenied during login procedure
This commit is contained in:
@@ -2037,6 +2037,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case EResult.AccessDenied: // Usually means refresh token is no longer authorized to use, otherwise just try again
|
||||||
case EResult.AccountLoginDeniedNeedTwoFactor:
|
case EResult.AccountLoginDeniedNeedTwoFactor:
|
||||||
case EResult.DuplicateRequest: // This will happen if user reacts to popup and tries to use the code afterwards, we have the code saved in ASF, we just need to try again
|
case EResult.DuplicateRequest: // This will happen if user reacts to popup and tries to use the code afterwards, we have the code saved in ASF, we just need to try again
|
||||||
case EResult.FileNotFound: // User denied approval despite telling us that he accepted it, just try again
|
case EResult.FileNotFound: // User denied approval despite telling us that he accepted it, just try again
|
||||||
@@ -2064,6 +2065,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case EResult.AccessDenied when string.IsNullOrEmpty(BotDatabase.RefreshToken) && (++LoginFailures >= MaxLoginFailures):
|
||||||
case EResult.InvalidPassword when string.IsNullOrEmpty(BotDatabase.RefreshToken) && (++LoginFailures >= MaxLoginFailures):
|
case EResult.InvalidPassword when string.IsNullOrEmpty(BotDatabase.RefreshToken) && (++LoginFailures >= MaxLoginFailures):
|
||||||
LoginFailures = 0;
|
LoginFailures = 0;
|
||||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.BotInvalidPasswordDuringLogin, MaxLoginFailures));
|
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.BotInvalidPasswordDuringLogin, MaxLoginFailures));
|
||||||
@@ -2565,12 +2567,14 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
|
|||||||
case EResult.AccountDisabled:
|
case EResult.AccountDisabled:
|
||||||
// Do not attempt to reconnect, those failures are permanent
|
// Do not attempt to reconnect, those failures are permanent
|
||||||
return;
|
return;
|
||||||
|
case EResult.AccessDenied when !string.IsNullOrEmpty(BotDatabase.RefreshToken):
|
||||||
case EResult.InvalidPassword when !string.IsNullOrEmpty(BotDatabase.RefreshToken):
|
case EResult.InvalidPassword when !string.IsNullOrEmpty(BotDatabase.RefreshToken):
|
||||||
// We can retry immediately
|
// We can retry immediately
|
||||||
BotDatabase.RefreshToken = null;
|
BotDatabase.RefreshToken = null;
|
||||||
ArchiLogger.LogGenericInfo(Strings.BotRemovedExpiredLoginKey);
|
ArchiLogger.LogGenericInfo(Strings.BotRemovedExpiredLoginKey);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case EResult.AccessDenied:
|
||||||
case EResult.RateLimitExceeded:
|
case EResult.RateLimitExceeded:
|
||||||
ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotRateLimitExceeded, TimeSpan.FromMinutes(LoginCooldownInMinutes).ToHumanReadable()));
|
ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotRateLimitExceeded, TimeSpan.FromMinutes(LoginCooldownInMinutes).ToHumanReadable()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user