0

I'm working on a custom Minecraft launcher and having some issues. I need to send a POST request with some JSON in it to "https://authserver.mojang.com/" and then retrieve some JSON that is returned.

However, I am having issues sending the request. Whenever I try to send the HTTP Request, it errors 405--the request method was not correct. I'm not sure why its saying that. The requirements for authentication are detailed at: http://wiki.vg/Authentication. Below is my code for creating the http_client:

http_client client(L"https://authserver.mojang.com/");
http_request requester;
requester.set_body(obj2);
requester.set_method(methods::POST);
requester.headers().set_content_type(U("application/json"));

Any help would be greatly appreciated!

SeargentGen
  • 100
  • 2
  • 12
  • Just emptied the request so it only send a blank POST--same issue. Leads me to believe that the issue lies in Casablanca's POST format? – SeargentGen Mar 30 '15 at 01:29

2 Answers2

1

The link you posted says the endpoint is /authenticate, which leads me to believe the URL should be https://authserver.mojang.com/authenticate, not the one you wrote in your post. Try that.

Steve
  • 6,334
  • 4
  • 39
  • 67
-1

The following request works correctly and returned an access token:

POST https://authserver.mojang.com/authenticate HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Content-Length: 147
Host: authserver.mojang.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

{
  "agent": {
    "name": "Minecraft",
    "version": 1
  },
  "username": "*******************",
  "password": "*********",
  "clientToken": ""
}
Peter R
  • 2,865
  • 18
  • 19