diff --git a/MinecraftClient/Protocol/MicrosoftAuthentication.cs b/MinecraftClient/Protocol/MicrosoftAuthentication.cs index 50f2397c..4c84ce47 100644 --- a/MinecraftClient/Protocol/MicrosoftAuthentication.cs +++ b/MinecraftClient/Protocol/MicrosoftAuthentication.cs @@ -94,6 +94,10 @@ namespace MinecraftClient.Protocol /// Login response with access token and refresh token public static LoginResponse PollDeviceCodeToken(string deviceCode, int expiresIn, int interval) { + // Per OAuth 2.0 device code spec, server may respond with "slow_down" requiring + // the client to increase its polling interval by this amount + const int SlowDownIncrementSeconds = 5; + string postData = string.Format( "client_id={0}&grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code={1}", clientId, deviceCode); @@ -123,8 +127,8 @@ namespace MinecraftClient.Protocol } else if (error == "slow_down") { - // Server asked us to slow down, increase interval by 5 seconds - pollInterval += 5; + // Server asked us to slow down + pollInterval += SlowDownIncrementSeconds; continue; } else if (error == "expired_token") diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs index 7a58c400..9dbd3be8 100644 --- a/MinecraftClient/Protocol/ProtocolHandler.cs +++ b/MinecraftClient/Protocol/ProtocolHandler.cs @@ -808,7 +808,7 @@ namespace MinecraftClient.Protocol ConsoleIO.WriteLineFormatted("§c" + e.StackTrace); } - return LoginResult.WrongPassword; + return LoginResult.OtherError; } }