When trying to login using Jsoup connect on a website (in order to retrieve cookies for future requests), the request works fine on the emulator but not on my device. Here is a piece of code :
// login data passed as a body using application/xxx-form-urlencoded
Map<String, String> data = new HashMap<>();
Map<String, String> headers = new HashMap<>();
Connection conn = Jsoup.connect(login_url)
.data(list)
.headers(headers)
.method(Connection.Method.POST)
.ignoreHttpErrors(true);
Connection.Response res = conn.execute();
Everything is fine on the emulator : it returns a 200 with the cookies I am expecting. On device it returns a 404 : according to some tests on Postman it means that the login fails, but I can't figure out why... Both connection parameters are identical.
The SDK version is ok, I tried with other methods (HttpUrlConnection) but it won't work either..
Is there something I am missing ?
Thanks for the help !
我做了一个 HttpUrlConnection ,它解决了我的问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.