I am developing an Android app with a NodeJS backend server. I am having problems authenticating the users when requests are made to different pages after the user is logged in.
Once I log in, i store the set-cookie value in SharedPrefs. Now when I make a POST request, I am sending the set-cookie value in the header, i.e. con.setRequestProperty("set-cookie", cookie); for authenticating the user on the backend using req.user.authenticate. 
However, req.user is undefined and hence the request fails. What could be wrong over here? Thanks.
Below is my POST request code.
    con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("User-Agent", "\"Mozilla/5.0\"");
    con.setDoOutput(true);
    JSONObject jsonParam = new JSONObject();
    try {
        jsonObject.accumulate("set-cookie", cookie);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    OutputStreamWriter out = new   OutputStreamWriter(con.getOutputStream());
    out.write(jsonParam.toString());
    out.close();
    int responseCode = con.getResponseCode();
    System.out.println("Response Code:"+responseCode);
 
    