Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

[BUG] Microsoft authenticate failed: The given key was not present in the dictionary

Open twnku opened this issue 3 years ago • 1 comments

Prerequisites

  • [X] I made sure I am running the latest development build
  • [X] I tried to look for similar issues before opening a new one
  • [X] I have set debugmessages=true in config to diagnose my issue
  • [X] I have redacted session tokens and passwords before attaching screenshots

Minecraft Version

1.16.5

Console Client Version

Minecraft Console Client v1.18.2 - for MC 1.4.6 to 1.18.2 - Github.com/MCCTeam | GitHub build 20, built on 2022-05-06 from commit b3cc235

Expected Behavior

successfully connected to the server

Actual Behavior

Microsoft authenticate failed: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at MinecraftClient.Protocol.MinecraftWithXbox.LoginWithXbox(String userHash, String xstsToken)
   at MinecraftClient.Protocol.ProtocolHandler.MicrosoftLogin(LoginResponse msaResponse, SessionToken& session)

sometimes it can also cause the client to stuck on a loop while logging (AutoRelog) until it crashed

Steps to Reproduce the bug

this (sometimes) happen when

  • reconnect/rejoin to the server (or from AutoRelog feature)
  • login with multiple accounts at the same time

and i can reproduce this issue by closing and opening the client multiple times and/or running multiple clients at the same time

Attach screenshot here (If applicable)

alt text

Anythings that could help diagnosing the bug

Minecraft Console Client v1.18.2 - for MC 1.4.6 to 1.18.2 - Github.com/MCCTeam
GitHub build 20, built on 2022-05-06 from commit b3cc235
[MCC] [Settings] Loading Settings from C:\[REDACTED]\MinecraftClient.ini
Resolving [REDACTED]...
14:43:56 [MCC] [Translations] No translation file found for en. (Looked 'C:\[REDACTED]\en.ini'
14:43:56 [MCC] [Translations] No translation file found for system language (en). (Looked 'C:\[REDACTED]\en.ini'
14:43:56 Color test: Your terminal should display [0123456789ABCDEF]: [0123456789ABCDEF]
Connecting to Microsoft...
< GET /oauth20_authorize.srf?client_id=[REDACTED]&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=service::user.auth.xboxlive.com::MBI_SSL&display=touch&response_type=token&locale=en HTTP/1.0
< Host: login.live.com
< User-Agent: Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
< Accept: */*
< Connection: close
<
<
< POST /ppsecure/post.srf?client_id=[REDACTED]&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=service::user.auth.xboxlive.com::MBI_SSL&display=touch&response_type=token&locale=en&contextid=[REDACTED]&bk=[REDACTED]&uaid=[REDACTED]&pid=[REDACTED] HTTP/1.0
< Cookie: MSPRequ=id=N&lt=[REDACTED]&co=1; uaid=[REDACTED]; OParams=[REDACTED]; MSPOK=$uuid-[REDACTED]
< Host: login.live.com
< User-Agent: Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
< Accept: */*
< Connection: close
< Content-Type: application/x-www-form-urlencoded
< Content-Length: 300
<
< login=[REDACTED]&loginfmt=[REDACTED]&passwd=[REDACTED]&PPFT=[REDACTED]
Status code: 302
Headers:
  cache-control: no-store, no-cache
  pragma: no-cache
  content-type: text/html; charset=utf-8
  expires: Thu, 19 May 2022 14:42:57 GMT
  location: https://login.live.com/oauth20_desktop.srf?lc=1033#access_token=[REDACTED]&user_id=[REDACTED]
  p3p: CP="DSP CUR OTPi IND OTRi ONL FIN"
  referrer-policy: strict-origin-when-cross-origin
  x-ms-route-info: R3_BAY
  x-ms-request-id: [REDACTED]
  ppserver: PPV: 30 H: BY1PPF1AEAA7DAC V: 0
  x-content-type-options: nosniff
  strict-transport-security: max-age=31536000
  x-xss-protection: 1; mode=block
  date: Thu, 19 May 2022 14:43:57 GMT
  connection: close
  content-length: 0

Cookies:
  MSPOK=
  __Host-MSAAUTH=-[REDACTED]
  __Host-MSAAUTHP=
  PPLState=1
  MSPShared=
  MSPPre=[REDACTED]|[REDACTED]||
  MSPCID=[REDACTED]
  MSPAuth=[REDACTED]
  MSPProf=[REDACTED]
  NAP=[REDACTED]
  ANON=[REDACTED]
  pres=
  LOpt=
  WLSSC=[REDACTED]
  MSPOAuthVis=
  JSH=[REDACTED]

< GET /oauth20_desktop.srf?lc=1033 HTTP/1.0
< Host: login.live.com
< User-Agent: MCC/1.18.2
< Accept: */*
< Connection: close
<
<
< POST /user/authenticate HTTP/1.0
< Host: user.auth.xboxlive.com
< User-Agent: Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
< Accept: application/json
< Connection: close
< x-xbl-contract-version: 0
< Content-Type: application/json
< Content-Length: 1176
<
< {"Properties": {"AuthMethod": "RPS","SiteName": "user.auth.xboxlive.com","RpsTicket": "[REDACTED]"},"RelyingParty": "http://auth.xboxlive.com","TokenType": "JWT"}
Status code: 200
Headers:
  cache-control: no-cache, no-store
  keep-alive: true
  content-length: 1662
  content-type: application/json
  ms-cv: [REDACTED]
  x-content-type-options: nosniff
  x-xblcorrelationid: 00000000-0000-0000-0000-000000000000
  x-err: 00000005
  date: Thu, 19 May 2022 14:43:57 GMT
  connection: close

Body: (Truncated to 200 characters)
{"IssueInstant":"2022-05-19T14:43:58.2221485Z","NotAfter":"2022-06-02T14:43:58.2221485Z","Token":"[REDACTED]

< POST /xsts/authorize HTTP/1.0
< Host: xsts.auth.xboxlive.com
< User-Agent: Mozilla/5.0 (XboxReplay; XboxLiveAuth/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
< Accept: application/json
< Connection: close
< x-xbl-contract-version: 1
< Content-Type: application/json
< Content-Length: 1633
<
< {"Properties": {"SandboxId": "RETAIL","UserTokens": ["[REDACTED]"]},"RelyingParty": "rp://api.minecraftservices.com/","TokenType": "JWT"}
Status code: 200
Headers:
  cache-control: no-cache, no-store
  keep-alive: true
  content-length: 2259
  content-type: application/json
  ms-cv: [REDACTED]
  x-content-type-options: nosniff
  x-xblcorrelationid: [REDACTED]
  date: Thu, 19 May 2022 14:43:58 GMT
  connection: close

Body: (Truncated to 200 characters)
{"IssueInstant":"2022-05-19T14:43:58.8570297Z","NotAfter":"2022-05-20T06:43:58.8570297Z","Token":"[REDACTED]

< POST /authentication/login_with_xbox HTTP/1.0
< Host: api.minecraftservices.com
< User-Agent: MCC/1.18.2
< Accept: application/json
< Connection: close
< Content-Type: application/json
< Content-Length: 2153
<
< {"identityToken": "XBL3.0 x=[REDACTED]"}
Status code: 429
Headers:
  content-type: application/json
  content-length: 48
  connection: close
  date: Thu, 19 May 2022 14:43:59 GMT
  cache-control: no-store
  x-minecraft-request-id: [REDACTED]
  x-cache: Error from cloudfront
  via: 1.1 [REDACTED].cloudfront.net (CloudFront)
  x-amz-cf-pop: HKG54-C1
  x-amz-cf-id: [REDACTED]

Body:
{
  "path" : "/authentication/login_with_xbox"
}

14:43:59 Microsoft authenticate failed: The given key was not present in the dictionary.
14:43:59    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at MinecraftClient.Protocol.MinecraftWithXbox.LoginWithXbox(String userHash, String xstsToken)
   at MinecraftClient.Protocol.ProtocolHandler.MicrosoftLogin(LoginResponse msaResponse, SessionToken& session)
Login failed :Incorrect password, blacklisted IP or too many logins.
14:43:59 [MCC] [AutoRelog] Launching with 2147483647 reconnection attempts
14:43:59 [MCC] [AutoRelog] Initializing without a kick message file
14:43:59 [MCC] [AutoRelog] Got disconnected with message: Login failed :Incorrect password, blacklisted IP or too many logins.
14:43:59 [MCC] [AutoRelog] Ignoring kick message, reconnecting anyway.
14:43:59 [MCC] [AutoRelog] Waiting 60 seconds before reconnecting...

Device

VPS

Operating System

Windows

Server Address (If applicable)

No response

twnku avatar May 19 '22 15:05 twnku

Thanks for the detailed report. By viewing your logs, I think you were being rate-limited by Microsoft, as login request to Xbox return HTTP code 429 Too Many Request. Unfortunately there is nothing we can do to solve the rate-limited issue besides adding a more friendly error message. Maybe you could try to reduce the login frequency or use a proxy.

ReinforceZwei avatar May 20 '22 05:05 ReinforceZwei