Authentication: Difference between revisions

From wiki.vg
Jump to navigation Jump to search
imported>Ker
mNo edit summary
imported>Download
(Updated for changes that have taken place in the authentication and update protocols.)
Line 1: Line 1:
Minecraft Alpha uses an entirely new authentication scheme, both for improved security and to (at least try to) prevent people from stealing the game. Take everything on this page [http://en.wikipedia.org/wiki/Grain_of_salt with a grain of salt], as the protocol can change at any time.
Minecraft Alpha uses an entirely new authentication scheme, both for improved security and to (at least try to) prevent people from stealing the game. Take everything on this page [http://en.wikipedia.org/wiki/Grain_of_salt with a grain of salt], as the protocol can change at any time.


== The Launcher ==
== The Old Launcher ==
The first step occurs as soon as you open the downloadable Minecraft launcher and attempt to login. The launcher will make a HTTP GET request like so:
The first step occurs as soon as you open the downloadable Minecraft launcher and attempt to login. The launcher will make a HTTP POST request to:
<pre>http://www.minecraft.net/game/getversion.jsp?user=<username>&password=<password>&version=<launcher version></pre>
<pre>http://www.minecraft.net/game/getversion.jsp</pre>
with the postdata:
<pre>user=<username>&password=<password>&version=<launcher version></pre>
with a "application/x-www-form-urlencoded" Content-Type header.
The current launcher version is ''12'', sending a value lower than this will cause the server to return "Old Version" '''however''' you can send any large number and it will return as expected. If the login succeeded, it will return 4 ':' delimited values.
The current launcher version is ''12'', sending a value lower than this will cause the server to return "Old Version" '''however''' you can send any large number and it will return as expected. If the login succeeded, it will return 4 ':' delimited values.
<pre>1281688214000:a348b469d915a40c9eebd2b9919c1a39:TkTech:8204407531530365141:</pre>
<pre>1281688214000:a348b469d915a40c9eebd2b9919c1a39:TkTech:8204407531530365141:</pre>
The first value is the <u>current version</u> of the game files (not the launcher itself). The second value is your <u>download ticket</u> and is required to fetch new versions of minecraft.jar from the server. The third value is your case-correct username. The fourth value is your <u>session id</u> and is required to connect to servers.
The first value is the <u>current version</u> of the game files (not the launcher itself). The second value is your <u>download ticket</u> and used to be required to fetch new versions of minecraft.jar from the server. The third value is your case-correct username. The fourth value is your <u>session id</u> and is required to connect to servers.
 
== The New Launcher ==
The new launcher uses the same basic protocol as the old one, but at a different host and base address, and using HTTPS.
The HTTPS query goes to the new address:
<pre>https://login.minecraft.net/</pre>


== Requesting New Game Files ==
== Requesting New Game Files ==
Once you have a __download ticket__, it's possible to download a new version of minecraft.jar by making another HTTP GET request.
A download ticket used to be required to download a new version of minecraft.jar by making another HTTP GET request.
<pre>http://minecraft.net/game/minecraft.jar?user=<username>&ticket=<download ticket></pre>
<pre>http://minecraft.net/game/minecraft.jar?user=<username>&ticket=<download ticket></pre>
However, the new updates for the main program file do not require a download ticket and can be found at:
<pre>http://s3.amazonaws.com/MinecraftDownload/minecraft.jar</pre>
The other resource files for Minecraft are kept at:
<pre>http://s3.amazonaws.com/MinecraftResources/</pre>


== Connecting To A Server ==
== Connecting To A Server ==

Revision as of 21:44, 21 February 2011

Minecraft Alpha uses an entirely new authentication scheme, both for improved security and to (at least try to) prevent people from stealing the game. Take everything on this page with a grain of salt, as the protocol can change at any time.

The Old Launcher

The first step occurs as soon as you open the downloadable Minecraft launcher and attempt to login. The launcher will make a HTTP POST request to:

http://www.minecraft.net/game/getversion.jsp

with the postdata:

user=<username>&password=<password>&version=<launcher version>

with a "application/x-www-form-urlencoded" Content-Type header. The current launcher version is 12, sending a value lower than this will cause the server to return "Old Version" however you can send any large number and it will return as expected. If the login succeeded, it will return 4 ':' delimited values.

1281688214000:a348b469d915a40c9eebd2b9919c1a39:TkTech:8204407531530365141:

The first value is the current version of the game files (not the launcher itself). The second value is your download ticket and used to be required to fetch new versions of minecraft.jar from the server. The third value is your case-correct username. The fourth value is your session id and is required to connect to servers.

The New Launcher

The new launcher uses the same basic protocol as the old one, but at a different host and base address, and using HTTPS. The HTTPS query goes to the new address:

https://login.minecraft.net/

Requesting New Game Files

A download ticket used to be required to download a new version of minecraft.jar by making another HTTP GET request.

http://minecraft.net/game/minecraft.jar?user=<username>&ticket=<download ticket>

However, the new updates for the main program file do not require a download ticket and can be found at:

http://s3.amazonaws.com/MinecraftDownload/minecraft.jar

The other resource files for Minecraft are kept at:

http://s3.amazonaws.com/MinecraftResources/

Connecting To A Server

When you first attempt to connect to the server, you begin by sending the MC-Ver containing your case-sensitive username. The server will return one of three values: '-' for no authentication (in which case you can just continue joining), '+' for password protected or a hash if the server requires name authentication. Name verification is achieved by sending a HTTP GET request to the minecraft.net server:

http://www.minecraft.net/game/joinserver.jsp?user=<username>&sessionId=<session id>&serverId=<server hash>

If the server returns ok it's safe to continue joining the server, otherwise it'll disconnect you with an error message.

Verifying Name Authentication

The server will verify name authentication by making yet another HTTP GET request to minecraft.net:

http://www.minecraft.net/game/checkserver.jsp?user=<username>&serverId=<server hash>

The server hash is the same value that was sent to the client in the handshake. If the server returns YES then the client is authenticated and allowed to join. Otherwise the client will/should be kicked with “Failed to verify username!”.