i have succeeded to simulate login in Android 4.2.2 but it dose not work in Android 6.0.1, the response in Android 4.2.2 : {status”:”ok”, “authenticated”:true, “user”user:password”} but in Android 6.0.1 its like that {statsu”:”ok”, “authenticated”:true, “user”:””}. I am using OpenSSL 1.0.2g Android binaries in the Deployment and its working grate in 4.2.2 but in 6.0.1 not+the SDK is updated to latest version, sorry for the bad english and looking forward for help guys, what is missing ?
procedure TForm2.SpeedButton1Click(Sender: TObject);
var
lHTTP: TIdHTTP;
Params: TStrings;
Cookie: TIdCookie;
Token : string;
IdSSL: TIdSSLIOHandlerSocketOpenSSL;
begin
Params := TStringList.Create;
Params.Add(‘username=’ + Edit1.Text);
Params.Add(‘password=’ + Edit2.Text);
lHTTP := TIdHTTP.Create(nil);
try
IdSSL := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
IdSSL.SSLOptions.Method := sslvTLSv1_2;
IdSSL.SSLOptions.Mode := sslmClient;
lHTTP.IOHandler := IdSSL;
lHTTP.ReadTimeout := 30000;
lHTTP.HandleRedirects := True;
lHTTP.Request.UserAgent := ‘Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36’;
lHTTP.Get(‘https://www.instagram.com’, TStream(nil));
Cookie := lHTTP.CookieManager.CookieCollection.Cookie[‘csrftoken’, ‘www.instagram.com’];
if Cookie <> nil then
Token := Cookie.Value;
try
lHTTP.Request.CustomHeaders.Values[‘X-CSRFToken’] := Token;
lHTTP.Request.Accept := ‘*/*’;
lHTTP.Request.CustomHeaders.Values[‘X-Instagram-AJAX’] := ‘1’;
lHTTP.Request.CustomHeaders.Values[‘X-Requested-With’] := ‘XMLHttpRequest’;
lHTTP.Request.Referer := ‘https://www.instagram.com/’;
lHTTP.Request.ContentType := ‘application/x-www-form-urlencoded’;
lHTTP.Request.UserAgent := ‘Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36’;
Memo1.Lines.Add(lHTTP.Post(‘https://www.instagram.com/accounts/login/ajax/’, Params));
Finally
lHTTP.Free
end;
Finally
end;
end;
end.