I am not sure how to write a correct UnityWebRequest.Post from these information :
curl --location --request POST 'https://url.com/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic UE5weXFUUUZjU1NTSkQ4eDFzQ0Fh' \
--header 'Cookie: ASP.NET_SessionId=qqjltxh; LSW_WEB=gatewaytraffic01; back_apim-tst_https=gateway-swarm-manager-03' \
--data-urlencode 'grant_type=client_credentials'
The point of this request is to get a token. I've tried writing the request like this :
WWWForm form = new WWWForm();
form.AddField("Content-Type", "application/x-www-form-urlencoded");
form.AddField("Authorization", "Basic UE5wzQ0Fh");
form.AddField("Cookie" ,"ASP.NET_SessionId=qqjxh; LSW_WEB=gatewaytraffic01; back_apim-tst_https=gateway-swarm-manager-03");
form.AddField("grant_type" ,"client_credentials");
UnityWebRequest uwr = UnityWebRequest.Post("https://url.com/token", form);
yield return uwr.SendWebRequest();
I get an error 401, i'm really not sure about the fields "Cookie" and "grant_type". When i send the request without those fields i get an error 400.
Could somebody explain how i should do this request ?
Thanks.