Note that there are some explanatory texts on larger screens.

plurals
  1. POJSoup Throws IO Exception: Too many redirects occurred trying to load URL
    primarykey
    data
    text
    <p>I am trying to make a username migrater for minecraft.net as a mod so people will be able to migrate their account ingame to discourage cracking of accounts. In order to do that I need to post a form to the website. I manage to successfully obtain the cookies so that the authenticityToken will remain the same but whenever I try to post the data back to the site it throws 'java.io.IOException: Too many redirects occurred trying to load URL <a href="https://account.mojang.com/migrate" rel="nofollow">https://account.mojang.com/migrate</a>'</p> <p>I am really not sure why this is happening but it may be to do with the website. The authentityToken definitely matches. I have checked this when not posting to the site and supplying the same cookies. Here is the code I am currently using</p> <pre><code>try { Response response = Jsoup.connect("https://account.mojang.com/migrate").execute(); //downloads site to get the cookies String auth = response.body(); String auth2 = auth.split("name=\"authenticityToken\" value=\"")[1]; auth = auth2.split("\"&gt;")[0]; Map&lt;String, String&gt; cookies = response.cookies(); Connection connection = Jsoup.connect("https://account.mojang.com/migrate").data("action", "/migrate/check") .data("authenticityToken", auth) .data("mcusername", "username") .data("password", "password") .method(Method.POST) .followRedirects(true); for (Entry&lt;String, String&gt; cookie : cookies.entrySet()) { connection.cookie(cookie.getKey(), cookie.getValue()); } connection.execute(); //exception thrown here Document document = connection.get(); String docHtml = document.html(); System.out.println(docHtml); } catch (Exception e) { e.printStackTrace(); } </code></pre> <p>Any help at all would be appreciated greatly</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload