Description:
Greetings to all.
I am writing a parser. I am trying to log in to the Publisher Unity Asset Store account using the Jsoup library. But nothing comes out, because I can't get a token normally.
Using HTTPAnalyzer looked what is sent in the request.
As you can see in the screenshot above, in the request there is a field authenticity_token. The token is located on the authorization page (the first link above) in the html-code of the page in one of the <meta> tags.
I describe this so that it is clear that you cannot get a token BEFORE loading the page. Also, the token changes with each page refresh.
And it turns out that I can load the page as follows and fill in all the fields except the token.
Connection.Response response = Jsoup .connect(url) .userAgent(client) .data("utf8", "?") .data("authenticity_token", "???????????") .data("conversations_create_session_form[email]", "email@email.com") .data("conversations_create_session_form[password]", "password") .data("conversations_create_session_form[remember_me]", "true") .data("commit", "Log in") .execute(); Then parse the token:
token = response.parse() .select("meta") .get(5) .attr("content"); But it will not make sense, because the request has already been sent. Creating a new request will refresh the page and invalidate the sparking token.
Question: How to send a current token?
Please do not hesitate to make assumptions, I will be glad to any help :)
