B4J Question How to make multiple http calls with same session cookies to pass CSRF token check

mcqueccu

Well-Known Member
Licensed User
Longtime User
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?
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
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
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…