Maome / ingress-bot

49 stars 31 forks source link

XSRF Change #8

Open NinjaIndocto opened 10 years ago

NinjaIndocto commented 10 years ago

Hey I have a question do you have to change anything for the xsrftoken? I'm starting to get one with a (:) and what seems like a timestamp. Example:

"xsrfToken":"RbPFyO2my19BDQio8w6XXQWDj-U:1389203153862"

And recently I am getting 403 for server calls.

This is the code I'm getting a 403 for


  public String getInventory() throws Exception
    {
        JSONObject main = new JSONObject();
        JSONObject params = new JSONObject();
        Date d = new Date();
        params.put("lastQueryTimestamp", d.getTime()-6000);
        main.put("params",params);

        //Setup the json connection
        URL getObjectsURL = new URL(baseURL + "/rpc/playerUndecorated/getInventory");
        URLConnection getObjectsCon = getObjectsURL.openConnection();
        getObjectsCon.setRequestProperty("Cookie", this.authCookie);
        getObjectsCon.setRequestProperty("X-XsrfToken", this.xsrfToken);
        getObjectsCon.setRequestProperty("User-Agent", "Nemesis (gzip)");
        getObjectsCon.setDoOutput(true);
        //Setup and use the writer
        OutputStreamWriter out = new OutputStreamWriter(getObjectsCon.getOutputStream());
        out.write(main.toString());  //Write our json object to the connection
        out.close();

        //Setup and use the reader
        BufferedReader br = new BufferedReader(new InputStreamReader(getObjectsCon.getInputStream()));
        String line = br.readLine();
        br.close();
        return line;

    }

Any help would be appreciated

lecaros commented 10 years ago

get another authcookie :)

NinjaIndocto commented 10 years ago

The 403 happens right after the handshake so the auth cookie still should be good. Am I missing a request property or param?