I am trying to use okhttputils to register and log in to a website.
But the website has this CSRF token and CSRF name as hidden fields on the form.
Even though I was able to retrieve the CSRF token and name which I send with the form data, I still get CSRF Check Failed.
My question is, how can I make multiple HTTP calls whiles maintaining the same session/cookies?
Make all the httpcalls with the same job declaration before calling release, in that case, it maintains same session and cookies . At least that worked for me. If anyone have alternative solution too, I will be glad know it.
B4X:
Dim job as httpjob
Job.download(......)
Wait for jobdone BLA BLA BLA
'Do your stuffs
Job.poststring(.....)
Wait for jobdone BLA BLA BLA
'Do your stuffs
job.postmultipart(.....)
Wait for jobdone BLA BLA BLA
'Do your stuffs
Job.release
Nope. It has nothing to do with the HttpJob. If you are using OkHttpUtils2 then all jobs are handled by the same http client engine and will retain the cookies.