my specific idea: the first request to get two variables hidden in html, the second request with a user name and password, but no matter how to try, the first idea is correct, because the java side works well, and the java side does not set header and cookies
I use fiddler to test the request from the browser and the request from the local node. There is no problem with the parameters. I hope God will remind me where something may have gone wrong
.my code:
const request=require("superagent");
const cheerio = require("cheerio");
const querystring=require("querystring")
require("superagent-proxy")(request);
const proxy = "http://localhost:8888";
request.get("http://authserver.zust.edu.cn/authserver/login")
.end((err,res)=>{
const $ = cheerio.load(res.text);
let lt=$("input[name=lt]").val()
let c=res.headers["set-cookie"]
let execution=$("input[name=execution]").val()
let _eventId=$("input[name=_eventId]").val()
let rmShown=$("input[name=rmShown]").val()
let option={username:"****",password:"*****",lt,dllt:"userNamePasswordLogin",execution,_eventId:"submit",rmShown:"1"}
login(option,c,url)
})
function login(option,c,url){
request.post("http://authserver.zust.edu.cn/authserver/login")
.type("form")
.set("connection","keep-alive")
.send(querystring.stringify(option))
//.set("Cookie", c)
.proxy(proxy)
.end((err,res) => {
console.log(res.text)
})
}