broese / mcbuild

A custom Minecraft client with advanced auto-building capabilities
26 stars 11 forks source link

Failed to parse key selectedUser & user profile #17

Closed rasulsafa closed 6 years ago

rasulsafa commented 6 years ago

Whenever I try to connect to a server I get this error:

Incoming connection from 127.0.0.1:51602 Cannot open file bases.txt for reading: No such file or directory Cannot open file players.txt for reading: No such file or directory Selecting protocol 340 (1.12.2) ID=00011202 Failed to parse key selectedUser Failed to parse user profile EOF on the connection

In the minecraft client it says Failed to connect to the server Failed to verify username!

broese commented 6 years ago

Have you updated? Is your profile initialized? Also please check out the issue #16

rasulsafa commented 6 years ago

Yes. See https://github.com/broese/mcbuild/issues/18

broese commented 6 years ago

Hi, sorry for the delay, but I finally got to analyzing this issue. It's not that simple as it seems. I've just tested fresh profiles created with 4 different launchers: 1.6.44 - v17, outdated 1.6.61 - v18 1.6.73j - v18, but with 'profilesFormat' key added 1.6.84j - v21, current version

They all have the same format as handled by the case 18/case 21 block in my code, so your fix is not correct as far as I see. It seems that I have lost the launcher version 1.6.82j that I suppose was generating v20 of the profile format, so I can't reproduce that - do you have it lying around by any chance?

Can you send me your launcher_profile.json (but please replace all sensitive info - name, UUID, access token, etc with dummy values!) - there might be some differences between the accounts that I can't reproduce.

broese commented 6 years ago

Here are the examples of two profiles produced by 1.6.61 and 1.6.84j Launcher - 1.6.61, v18

{
  "profiles": {
    "UserName": {
      "name": "UserName"
    }
  },
  "selectedProfile": "UserName",
  "clientToken": "12345678-1234-abcd-1234-123456789abc",
  "authenticationDatabase": {
    "0123456789abcdef0123456789abcdef": {
      "displayName": "UserName",
      "accessToken": "aaaabbbbccccddddeeeeffff00001111",
      "userid": "89abcdef0123456789abcdef01234567",
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "username": "User@example.com"
    }
  },
  "selectedUser": "0123456789abcdef0123456789abcdef",
  "launcherVersion": {
    "name": "1.6.61",
    "format": 18
  }
}

Launcher 1.6.84-j, v21

{
  "profiles": {
    "UserName": {
      "name": "UserName"
    }
  },
  "selectedProfile": "UserName",
  "clientToken": "12345678-1234-abcd-1234-123456789abc",
  "authenticationDatabase": {
    "0123456789abcdef0123456789abcdef": {
      "displayName": "UserName",
      "accessToken": "aaaabbbbccccddddeeeeffff00001111",
      "userid": "89abcdef0123456789abcdef01234567",
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "username": "User@example.com"
    }
  },
  "selectedUser": "0123456789abcdef0123456789abcdef",
  "launcherVersion": {
    "name": "1.6.84-j",
    "format": 21,
    "profilesFormat": 1
  }
}
landline commented 6 years ago

Thank you for your continued support of this project.

Ed Gage (aka Landline)

On Mon, Nov 20, 2017 at 11:38 PM, Eduard Bröse notifications@github.com wrote:

Here are the examples of two profiles produced by 1.6.61 and 1.6.84j Launcher - 1.6.61, v18 { "profiles": { "UserName": { "name": "UserName" } }, "selectedProfile": "UserName", "clientToken": "12345678-1234-abcd-1234-123456789abc", "authenticationDatabase": { "0123456789abcdef0123456789abcdef": { "displayName": "Dorquemada", "accessToken": " d7109a3f6d9842e7b45bb592b8d06f2a", "userid": " 6cea6b933ec86f7feb83d064b8fbd68f", "uuid": "01234567-89ab-cdef-0123-456789abcdef", "username": "User@example.com" } }, "selectedUser": " 0123456789abcdef0123456789abcdef", "launcherVersion": { "name": "1.6.61", "format": 18 } }

Launcher 1.6.84-j, v21 { "profiles": { "UserName": { "name": "UserName" } }, "selectedProfile": "UserName", "clientToken": "12345678-1234-abcd-1234-123456789abc", "authenticationDatabase": { "0123456789abcdef0123456789abcdef": { "displayName": "Dorquemada", "accessToken": " d7109a3f6d9842e7b45bb592b8d06f2a", "userid": " 6cea6b933ec86f7feb83d064b8fbd68f", "uuid": "01234567-89ab-cdef-0123-456789abcdef", "username": "User@example.com" } }, "selectedUser": " 0123456789abcdef0123456789abcdef", "launcherVersion": { "name": "1.6.84-j", "format": 21, "profilesFormat": 1 } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-345931439, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4stGkt34O9ibfcUhmd1Yb5gT6Dtpgks5s4nACgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

broese commented 6 years ago

@landline, do you have more info on that? Do you experience similar problem @rasulsafa described? I'd like to provide more compatibility between the versions (and Mojang keeps making things difficult with their sudden updates), but I really need more input on this issue.

rasulsafa commented 6 years ago

My launcher version is 2.0.1003, I think you're using the old launcher. This is my launcher_profiles.json As you can see, it matches format 20. What I think is happening is that mojang is using different profileFormats for the different launchers, 1.6.x and 2.0.x.

{
  "settings": {
    "locale": "en-us",
    "showMenu": true
  },
  "launcherVersion": {
    "name": "2.0.1003",
    "format": 21,
    "profilesFormat": 2
  },
  "profiles": {
    "acadbisidas": {
      "type": "latest-release",
      "lastUsed": "2017-11-14T02:42:39.296Z"
    },
    "fgdsfasdasdsda": {
      "type": "latest-snapshot",
      "lastUsed": "1970-01-01T00:00:00.000Z"
    },
    "dfgsdfdfsd": {
      "name": "Optifine",
      "type": "custom",
      "created": "2017-11-14T02:42:15.021Z",
      "lastUsed": "2017-11-21T03:08:02.461Z",
      "lastVersionId": "1.12.2-OptiFine_HD_U_C6"
    }
  },
  "authenticationDatabase": {
    "asdfghsdcasddaasdasa": {
      "accessToken": "asdfghjkkl",
      "username": "email@gmail.com",
      "profiles": {
        "<my uuid>": {
          "displayName": "Illorum"
        }
      }
    }
  },
  "selectedUser": {
    "account": "ffgdsdaasas",
    "profile": "<my uuid>"
  },
  "analyticsToken": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "analyticsFailcount": 0,
  "clientToken": "abcasiudhauisdhiad"
}
landline commented 6 years ago

I had made the aforementioned changes manually. Haven't mcb_update'd yet. Will advise.

--Ed

On Tue, Nov 21, 2017 at 1:01 PM, Eduard Bröse notifications@github.com wrote:

@landline https://github.com/landline, do you have more info on that? Do you experience similar problem @rasulsafa https://github.com/rasulsafa described? I'd like to provide more compatibility between the versions (and Mojang keeps making things difficult with their sudden updates), but I really need more input on this issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-346143997, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4smBSyBdrLn4ExsActoLTlzdb-eLhks5s4ywCgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

landline commented 6 years ago

Seems to work.

MCBuild 2.0 for Minecraft 1.9.x-1.12.2 Multi-protocol support: 107,109,110,210,315,316,335,338,340 MC Proxy address : 0.0.0.0:25565 Remote server : ############.com:25565 Incoming connection from 192.168.1.162:54976 Cannot open file bases.txt for reading: No such file or directory Cannot open file players.txt for reading: No such file or directory Selecting protocol 338 (1.12.1) ID=00011201

On Tue, Nov 21, 2017 at 1:42 PM, Ed Gage edgage@gmail.com wrote:

I had made the aforementioned changes manually. Haven't mcb_update'd yet. Will advise.

--Ed

On Tue, Nov 21, 2017 at 1:01 PM, Eduard Bröse notifications@github.com wrote:

@landline https://github.com/landline, do you have more info on that? Do you experience similar problem @rasulsafa https://github.com/rasulsafa described? I'd like to provide more compatibility between the versions (and Mojang keeps making things difficult with their sudden updates), but I really need more input on this issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-346143997, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4smBSyBdrLn4ExsActoLTlzdb-eLhks5s4ywCgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

-- http://thegagepages.net/ebiado

rasulsafa commented 6 years ago

@landline what launcher are you using? What manual changes did you make?

landline commented 6 years ago

Launcher 2.0.1003

I manually changed mcproxy.c on my local copy with the changes to switch (format) (line 831) as suggested by rasulsafa on November 13.

I connect to a 1.12.1 server typically. Have not tried with 1.12.2 .

On Tue, Nov 21, 2017 at 1:46 PM, rasulsafa notifications@github.com wrote:

@landline https://github.com/landline what launcher are you using? What manual changes did you make?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-346155525, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4shG3i41wuKVb8Z8hL8Xfg0KihZFDks5s4zaQgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

broese commented 6 years ago

Are 2.x launchers widespread yet? I thought they were a version in development? When I get a fresh installation package, I get 1.6.84j launcher downloaded. Is it a Windows 10 thing?

OK, I'll get to investigate that. Your profile says "profilesFormat": 2 - this is probably the issue I'm missing. This would mean the profile format value does not specify the format of the profile after all. Mojang is a f***ng mess.

landline commented 6 years ago

I didn't ask for 2.0.1003, it just appeared one day. Not sure why you are stuck back at 1.6.84j.

Also, just out of curiosity, when you actually play Minecraft, which server do you hang out on?

--landline

On Tue, Nov 21, 2017 at 3:34 PM, Eduard Bröse notifications@github.com wrote:

Are 2.x launchers widespread yet? I thought they were a version in development? When I get a fresh installation package, I get 1.6.84j launcher downloaded

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-346183528, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4slTFy8ED1V8Vlnbr-QXKwVRxnjiLks5s40_bgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

broese commented 6 years ago

I don't play much right now, but I was pretty active on 2b2t.org a while ago - which would explain the default setting for the server. The difference might be because I'm using Linux, and I don't have accessible Windows installed at all. I think I heard that Windows10 users get the new launcher version by default, that's why I was wondering.

broese commented 6 years ago

One more question: in

"selectedUser": {
  ...
  "profile": "<my uuid>"
},

is UUID in dashed format (e.g. '01234567-89ab-cdef-0123-456789abcdef'), or compacted ('0123456789abcdef0123456789abcdef')? Or better yet - does it match the key in "authenticationDatabase" exactly?

rasulsafa commented 6 years ago

compacted, and no - but authenticationDatabase matches selectedUser>account. So its like this:

"authenticationDatabase": {
    "<account>": {
       ....
      }
},
"selectedUser": {
    "account": "<account>",
    "profile": "<compacted player uuid>"
  }
broese commented 6 years ago

Fixed the profile parsing to make it independent from the indicated version. Please test if it works OK for you now.

broese commented 6 years ago

I got a 2.0.x launcher running and made another profile. The mistake was that the user ID was under 'account', not 'profile' Please try again if it works now.

landline commented 6 years ago

MCBuild 2.0 for Minecraft 1.9.x-1.12.2 Multi-protocol support: 107,109,110,210,315,316,335,338,340 MC Proxy address : 0.0.0.0:25565 Remote server : smp.*****.com:25565 Incoming connection from 192.168.1.126:50602 Cannot open file bases.txt for reading: No such file or directory Cannot open file players.txt for reading: No such file or directory Selecting protocol 338 (1.12.1) ID=00011201 {"error":"ForbiddenOperationException","errorMessage":"Invalid token"}EOF on the connection

On Mon, Nov 27, 2017 at 3:50 PM, Eduard Bröse notifications@github.com wrote:

I got a 2.0.x launcher running and made another profile. The mistake was that the user ID was under 'account', not 'profile' Please try again if it works now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-347355477, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4sjKuWvzPy_eQ6uDAwIPYupJ3kF2lks5s6zy-gaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

broese commented 6 years ago

OK, I made yet another mistake - now I realize that the new profile format uses accountID/UUID pair instead of UUID. The new profile uses accountID as the key in the auth database, while the old profile uses UUID.

Can you update and try again please? I was able to connect using both 1.6.84 and a 2.0.1003 profiles (by specifying profile location explicitly with the -p option)

landline commented 6 years ago

Seems to be functioning correctly. I'll test further for my next build, but it did allow me to log in, no issues. Was able to do all the normal moving around type things...

You are truly amazing, Mr. Brose.

Ed Gage Greeley, CO

On Mon, Nov 27, 2017 at 10:37 PM, Eduard Bröse notifications@github.com wrote:

OK, I made yet another mistake - now I realize that the new profile format uses accountID/UUID pair instead of UUID. The new profile uses accountID as the key in the auth database, while the old profile uses UUID.

Can you update and try again please? I was able to connect using both 1.6.84 and a 2.0.1003 profiles (by specifying profile location explicitly with the -p option)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/broese/mcbuild/issues/17#issuecomment-347419213, or mute the thread https://github.com/notifications/unsubscribe-auth/ABu4sjTVfCJwt2CdE6JDZv_2h-6ZyEkpks5s65wTgaJpZM4QaGO0 .

-- http://thegagepages.net/ebiado

rasulsafa commented 6 years ago

It works