c++jsonhttpminecraftcasablanca

C++ Casablanca POST request


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!


Solution

  • 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.