誰かが mojang アカウントにログインできるようにする Minecraft 用の何かを作ろうとしています。私はjsoupでこれをやろうとしています。これには問題がありますが、通常のログイン ページであるhttps://account.mojang.com/meにリダイレクトすると 404 エラーが発生しますか?
public String connect() {
try {
final Response response =
Jsoup.connect("https://account.mojang.com/login").execute();
final Document doc = response.parse();
final Element authToken = doc.select("input[name^=authenticityToken]").get(0);
final Map<String, String> cookies = response.cookies();
final Connection connection =
Jsoup.connect("https://account.mojang.com/login")
.data("authenticityToken", authToken.val())
.data("username", "email")
.data("password", "password")
.method(Method.POST)
.followRedirects(true);
connection.timeout(10000);
for (final Entry<String, String> cookie : cookies.entrySet()) {
connection.cookie(cookie.getKey(), cookie.getValue());
}
final Response postResponse = connection.execute();
return postResponse.body().toLowerCase();
} catch (Exception e) { e.printStackTrace(); return "try again"; }
}
どんな助けでも大歓迎です