I have a website that I want to log into from an android app and in order to submit the POST request with right information, they need some hashed values. The way that the website does it is through a javascript file. I tried tracing through it but I couldn't get the same result as the native website.
So i've decided to download their javascript file and run it within java.
My issue is that I can't figure out how to run specific methods within their file.
Here's my code so far and it's extremely bare bones.
public void hashIt(String valueForMethod1, String valueForMethod2){
final ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine engine = sem.getEngineByName("JavaScript");
try {
engine.eval(new java.io.FileReader("res/raw/theirFile.js"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ScriptException e) {
e.printStackTrace();
}
}
Any help would be much appreciated :)
Thanks