Hi, My goal is to login successfully to a website. I have made a project isolating the issue, the code is basically the following.
first i isolate the authenticity token
URL lUrlGetTocken("https://thewebsite.com/login");
String lHtmlWithToken = lUrlGetTocken.readEntireTextStream().toUTF8();
lHtmlWithToken = lHtmlWithToken.fromLastOccurrenceOf("authenticity_token\" value=\"", false, true);
lHtmlWithToken = lHtmlWithToken.upToFirstOccurrenceOf("\"", false, false);
then I post the login datas.
URL lUrl = lUrlGetTocken.withParameter("password", aPasssword);
lUrl = lUrl.withParameter("email", aEmail);
lUrl = lUrl.withParameter("authenticity_token", lHtmlWithToken);
String lString = lUrl.readEntireTextStream(true);
finally i check if the response is the one matching a validated connection.
bool lLoggedIn = lString.contains("article class=\"registration\"") || lString.contains("/account\">redirected");
return lLoggedIn;
The response on Windows is the same as if the authenticity token was wrong. On OSX it logs me in. I am working with JUCE 5.4.7, and run the same code on XCode and Visual Studio 2015.
How can this be?
Thank you