Autologin With XSRF Token

Good Evening

Firstly I am not a developer at all and have struggled with most workers, so my knowledge is very limited.
Unfortunately I am unable to resolve a rather complex issue and would appreciate assistance from anyone willing to donate there valuable time to assist.

So in short I have a platform that requires login to access resources.
I created a link on a site that automatically does a post request to automatically log the user into the “demo” platform. Recently the platform was upgraded and now uses Tokens which has essentially broken my script.

Before i go further this is not sensitive data and am providing it to assist anyone willing to help.

So in the past i used to do a post as follows:



After the upgrade it seems that a “get” request needs to happen first to the location :

This will set the required headers/cookies for the client which will then be used on the json post when you login.

Now what i have tried is to create some form of a worker that does a parallel request , one to the base page to get all the required headers/cookies and the other which will be the post request to automatically log the user in.

I first thought of leaving the current auto login code as is and simply deploying a worker that will do a get to one url and then use that response headers/cookies for EVERY transaction going forward (for that users active session) essentially doing away with the complexities.