1

I'm trying to make a Minecraft client and I cant figure out how to get a session ID to start the game. I've done some googling and cant find anyway to get it bar from this answer to Launch Minecraft from command line - username and password as prefix that doesn't work.

pppery
  • 3,731
  • 22
  • 33
  • 46
Alfie Barlow
  • 33
  • 1
  • 2
  • 7

3 Answers3

1
Minecraft mc = Minecraft.getMinecraft();

mc.getSession().getToken();
pppery
  • 3,731
  • 22
  • 33
  • 46
TomJuri
  • 23
  • 4
0

You can manually crash your game by holding down F3 + C. In the crash log will be your session id.

pppery
  • 3,731
  • 22
  • 33
  • 46
Keppler97
  • 11
  • 4
0

I made a little script that returns the session id.

def GetSessionID(Username, Password):
    # Url = f'https://login.minecraft.net?user={Username}&password={Password}&version=13'
    Url = "https://authserver.mojang.com/authenticate"
    # LoginInfo = requests.post(Url)
    # LoginInfoList = LoginInfo.split(':')
    # SessionID = LoginInfoList[3]
    token = str(uuid.uuid4())
    requestData = GetAuthenticationBody(Username, Password, token)
    response = requests.post(url=Url, json=requestData)
    responseData = response.json()

    SessionID = responseData['accessToken']
    return SessionID

    def GetAuthenticationBody(username, password, token):
        body = {
            "agent":  {
                "name": "Minecraft",
                "version": 1
            },
            "username": username,
            "password": password,
            "clientToken": token,
            "requestUser": True
        }
        return body
pppery
  • 3,731
  • 22
  • 33
  • 46