User:NywAwd/Yggdrasil/Python

Here is a Python 2 script that generates the session ID needed to log in with the new launcher.

import urllib2 import sys import getpass import json

if len(sys.argv) != 3: username = raw_input('Username: ') password = getpass.getpass('Password: ') else: username = sys.argv[1] password = sys.argv[2]

data = { "agent": { "name": "Minecraft", "version": 1 },       "username": username, "password": password }

req = urllib2.Request(url='https://authserver.mojang.com/authenticate', data=json.dumps(data), headers={"Content-Type": "application/json"}) json = json.loads(urllib2.urlopen(req).read)

username = json['selectedProfile']['name'] access_token = json['accessToken'] profile_id = json['selectedProfile']['id']

session_param = 'token:%s:%s' % (access_token, profile_id)

print username print session_param