bogdanfinn / tls-client-api

This is an application which is using gosoline and TLS-Client to run a simple request forwarding service with the option to use specific tls fingerprints which are implemented in TLS-client
BSD 4-Clause "Original" or "Old" License
83 stars 9 forks source link

How to add cookies? #6

Closed j9a12c20k closed 1 year ago

j9a12c20k commented 1 year ago

Hello,

Just a question not issue, how do I add cookie to session? I am trying to add it like this however its not adding cookies.

setsession localhost:8080/api/forward payload: { "tlsClientIdentifier": "chrome_110", "requestUrl": "http://httpbin.org/cookies", "sessionId": "2", "followRedirects": true, "requestMethod": "GET", "withRandomTLSExtensionOrder": true }

setcookies localhost:8080/api/cookies payload: { "sessionId": "2", "cookies": [ { "name": "cookieName", "value": "cookieValue" } ] }

now it should have set the cookies however when i see the body its empty

getcookies localhost:8080/api/forward payload: { "tlsClientIdentifier": "chrome_110", "requestUrl": "http://httpbin.org/cookies", "sessionId": "2", "followRedirects": true, "requestMethod": "GET", "withRandomTLSExtensionOrder": true }

response "body": "{\n \"cookies\": {}\n}\n"

Expected "body": "{\n \"cookies\": {\n \"cookieName\": \"cookieValue\"\n }\n}\n"

bogdanfinn commented 1 year ago

@j9a12c20k on the tls-client-api there is no endpoint to add cookies to a session. only an endpoint to get cookies from a session.

you need to add the cookies to the actual forward request (your create session step). The field is: "requestCookies" and this is an array of cookie objects.

"requestCookies": [
{
  "name": "",
  "value": ""
},
{
  "name": "",
  "value": ""
}
]
j9a12c20k commented 1 year ago

Works thank you