I tried to log into my Facebook account with these lines that I read from an answer to a question already posted, but I can\'t log in anyway! I looking for some tips to corr
Try this, works fine for me:
Response req;
try {
String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36";
req = Jsoup.connect("https://m.facebook.com/login/async/?refsrc=https%3A%2F%2Fm.facebook.com%2F&lwv=100")
.userAgent(userAgent)
.method(Method.POST).data("email", "YOUR_EMAIL").data("pass", "YOUR_PASSWORD")
.followRedirects(true).execute();
Document d = Jsoup.connect("https://m.facebook.com/profile.php?ref=bookmarks").userAgent(userAgent)
.cookies(req.cookies()).get();
System.out.println(d.body().text().toString());
} catch (Exception e) {
e.printStackTrace();
}
There are a bunch other parameters that are passed in the request:
lsd:AVptuGRS
email:***
pass:***
default_persistent:0
timezone:-120
lgnrnd:043627_eQnN
lgnjs:1383914188
locale:en_US
And dont forget about referer parameter. Facebook may ganerate some sort of one-time token for login request to prevent bypassing of Facebook API.