Jump to content




[1.31+] Minecraft.net Login System


31 replies to this topic

#1 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 May 2012 - 02:03 AM

I was making a 'minebook' (facebook for minecraft) inside of computercraft I this post is to share the login part of that site.

local status = "Please login first."
local x,y = term.getSize()
function connect()
while true do
  term.clear()
  term.setCursorPos(1,1)
  print(status.. "n")
  print("Minecraft Username: ")
  write("Minecraft Password: ")
  test = string.len("Minecraft Password: *")

  term.setCursorPos(test, 3)
  user = read()
  term.setCursorPos(test, 4)
  pass = read()
  http.request("http://login.minecraft.net/?user=" ..user.. "&password=" ..pass.. "&version=12")
  local event, url, response = os.pullEvent()
  if event == "http_success" then
   _sResponse = { response.readAll() }
   if string.find(tostring(_sResponse[1]), "deprecated") then
	term.setCursorPos(1, y-1)
	textutils.slowPrint("Logging in...")
	sleep(0.5)
	break
   else
	status = tostring(_sResponse[1])
   end
  else
   status = ("Unable to connect to minecraft.net")
  end

  response.close()
end
end
connect()


First, it asks for your username
Then, it asks for your password
It connects to http://login.minecraft.net/?user=<USER>&password=<PASS>&version=12

(from the wiki)
And it prints whatever is inside that page.

If it doesn't exist, the page returns "Bad login" and it prints that.
If it does exist, but the password is wrong, it prints it again.
If it does exist, but the account is migrated, it prints "Account migrated. Use email to login."
If it exists, it will return <random number>:"deprecated":<your username>:<a session id(?)>
Since we can't find out the random number, username, and session id, we just search for "deprecated" (I haven't testing on non-migrated accounts. It still logs in if your not premium)

#2 Matthewaj

  • New Members
  • 12 posts

Posted 26 May 2012 - 02:47 AM

Nice!

and here's a meme to go along with this:
Posted Image

#3 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 May 2012 - 02:54 AM

View PostMatthewaj, on 26 May 2012 - 02:47 AM, said:

Nice!

and here's a meme to go along with this:
Posted Image

And to finish it:
*WHILE LOGGED INTO MINECRAFT

#4 Matthewaj

  • New Members
  • 12 posts

Posted 26 May 2012 - 02:58 AM

oh btw whats the link for the wiki page for the minecraft login and it there any more apis for minecraft accounts?

#5 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 26 May 2012 - 03:04 AM

Nice work on this man, I'm going to play around with it when I get home. Already got a couple of idea's on how I can use it.

#6 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 May 2012 - 03:42 AM

View PostMatthewaj, on 26 May 2012 - 02:58 AM, said:

oh btw whats the link for the wiki page for the minecraft login and it there any more apis for minecraft accounts?

http://www.minecraft...necraft.net_API

I found it there

#7 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 26 May 2012 - 04:33 AM

Gimme a sec, my site will have this. Then anyone who registers at my site will just have to write it down on their computer to enable it!
Unless they have a floppy that someone with an account has made for them...
Nvm, I'll just do this for the first DIST of Noodle-Sh.
NEways, thx!

#8 cant_delete_account

  • Members
  • 484 posts

Posted 26 May 2012 - 05:03 AM

I would suggest using HTTPS when dan fixes the HTTPS error with the HTTP API.
(because then the connection is encrypted (hackers can't steal your password) )
Also, thanks! I'll be using this.

#9 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 May 2012 - 05:08 AM

Also, this is the URL to check if you are premium incase you want a "VIP" section for your logins.

http://www.minecraft.net/haspaid.jsp?user=<USERNAME>


#10 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 26 May 2012 - 11:44 PM

(This code is from this:
http://pastebin.com/X3RqHkXK
)

I currently got the login, and the logout right :)/>
Will make a separate post with minebook later....

#11 Learning_inpaired

  • New Members
  • 77 posts

Posted 30 May 2012 - 10:51 PM

you should make a minecraft inside of minecraft and have it work in the screen but be like creative mode 0.0 EPIC wish i knew code -.-

#12 Knox

  • New Members
  • 1 posts

Posted 31 May 2012 - 04:32 AM

I'm no professional, but from what I know of the login system, when you disconnect from the server (if on one) and try and connect to any other server, wouldn't it give you a bad login error since you renewed your sessionID?

#13 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 31 May 2012 - 05:34 PM

View PostKnox, on 31 May 2012 - 04:32 AM, said:

I'm no professional, but from what I know of the login system, when you disconnect from the server (if on one) and try and connect to any other server, wouldn't it give you a bad login error since you renewed your sessionID?
I'm not sure about this, but I think that the session id is given when you start minecraft, not when connecting to a server. And I don't think it would cause any problem anyway, your renewing you session id, what's the problem?

Edit:
From the minecraft wiki:

Quote

...
when a server with online-mode=true checks if it should allow a player to join the game. The session ID is generated by the launcher when you log in
...

Edited by MysticT, 31 May 2012 - 05:36 PM.


#14 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 31 May 2012 - 08:22 PM

View PostMysticT, on 31 May 2012 - 05:34 PM, said:

View PostKnox, on 31 May 2012 - 04:32 AM, said:

I'm no professional, but from what I know of the login system, when you disconnect from the server (if on one) and try and connect to any other server, wouldn't it give you a bad login error since you renewed your sessionID?
I'm not sure about this, but I think that the session id is given when you start minecraft, not when connecting to a server. And I don't think it would cause any problem anyway, your renewing you session id, what's the problem?

Edit:
From the minecraft wiki:

Quote

...
when a server with online-mode=true checks if it should allow a player to join the game. The session ID is generated by the launcher when you log in
...

When you login to a server, it connects to another page on minecraft.net that requires your session ID, then the server validates you like that (so people don't just fake their username)

When you login to this, it also generates a new Session ID, but the one that your launcher is currently using stays the same.

So (non tested) it might give you Bad Login

EDIT:
(http://) session.minecraft.net/game/joinserver.jsp?user=<USERNAME>&sessionId=<SESSION ID>

#15 warfighter67

  • New Members
  • 2 posts

Posted 02 June 2012 - 04:27 AM

Now just make a mock-up Java compiler, and you can start working on Minecraft for Computercraft! Then you can play Minecraft on your computer in Minecraft!

#16 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 02 June 2012 - 08:09 AM

now how do i send and receive chat messages? i dont have MCP on my laptop so i cant look at the source code

#17 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 02 June 2012 - 08:21 AM

View Postabc, on 02 June 2012 - 08:09 AM, said:

now how do i send and receive chat messages? i dont have MCP on my laptop so i cant look at the source code

I might post a tutorial or something when I find out

Off topic:
I made one for java too :)/>
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.JTextField;

public class Connecter
{
public static String user = "user";
public static String pass = "password";
public static void main(String[] args) {
  try {
  
   URL google = new URL("http://login.minecraft.net/?user=" + user + "&password=" + pass + "&version=12");
   URLConnection yc = google.openConnection();
   BufferedReader in = new BufferedReader(new InputStreamReader(yc
	 .getInputStream()));
   String inputLine;
   while ((inputLine = in.readLine()) != null) {
	System.out.println(inputLine);
   }
   in.close();
  } catch (Exception e) {
   e.printStackTrace();
  }
}
}


#18 stumblinbear

  • New Members
  • 2 posts

Posted 05 June 2012 - 07:47 AM

Used this code in my startup file :)/>

Also added the os.pullEvent = os.pullEventRaw so players can't ctrl-t out of it :]
Now the players on my server have a reason to buy minecraft >:D/>

#19 Pinkishu

  • Members
  • 484 posts

Posted 05 June 2012 - 09:08 AM

View Poststumblinbear, on 05 June 2012 - 07:47 AM, said:

Used this code in my startup file :)/>

Also added the os.pullEvent = os.pullEventRaw so players can't ctrl-t out of it :]
Now the players on my server have a reason to buy minecraft > :D/>

and distrust you for the possibility of stealing their pw :3

#20 prasselpikachu

  • Members
  • 16 posts

Posted 22 July 2012 - 11:18 AM

You'd better change the line

pass = read()
to
pass = read("*")
with this the password will be shown as following:
Password: ********





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users