json_exporter icon indicating copy to clipboard operation
json_exporter copied to clipboard

Adding fonctionality to support cookie for secure sites authentication

Open pmeffre opened this issue 3 years ago • 5 comments
trafficstars

Is there a way to add the support of cookie file in the request header?

The cURL request must look like that: curl 'https://172.17.101.150/rest/v1/banner/post_auth' -H 'Cookie: id=550orR9UL-Q3yBx4IWOwNQ==; user=eyJ1c2VyIjoiYWRtaW4iLCJsZXZlbCI6MTUsInR5cGUiOiJMT0NBTCIsIm1ldGhvZCI6IkxPQ0FMIn0=' The cookie is is obtained via first login URL(user/password in POST): https://172.17.101.150/rest/v1/login

Thank you

pmeffre avatar Jun 20 '22 10:06 pmeffre

This is already possible via headers in the config file.

SuperQ avatar Jun 20 '22 13:06 SuperQ

Hi Thank you Could you give me a sample how to code that with a cookie file as input ? Regards,

Pierre

pmeffre avatar Jun 20 '22 16:06 pmeffre

Hi, I have the same problem and there is no clear information about it. Anyone can give an example if it works with "headers"?

DaBeOps avatar Jun 30 '22 08:06 DaBeOps

Could you give me a sample how to code that with a cookie file as input ?

You can set (static) custom header values in the config, but the value of the header can not be read from an external file.

rustycl0ck avatar Jul 11 '22 00:07 rustycl0ck

i add cookies like this:

  headers:
    Cookie: "session=xxxxxxxxxx"

thewangcj avatar Dec 28 '23 10:12 thewangcj