ha-multiscrape icon indicating copy to clipboard operation
ha-multiscrape copied to clipboard

Authentication cookies not forwarded

Open FoliniC opened this issue 2 years ago • 4 comments
trafficstars

Version of the custom_component

latest

Configuration

multiscrape:
  - resource: "http://192.168.0.1:1234/cgi-bin/reboot.sh?boot=now"
    scan_interval: 60000
    log_response: True
    button:
      - unique_id: reboot_router
        name: reboot router
    form_submit:
      submit_once: True
      resubmit_on_error: False
      resource: "http://192.168.0.1:1234/cgi-bin/get_password_cookie.sh"
      input:
        password: 'withChar&$#SG8Mb"^'
    sensor:
      - select: ""
        name: reboot_router```

## Describe the bug
From form_submit_response_body.txt I see the cookies are set correctly
Set-Cookie:hash=D678DFD98D668721F6E37F6F20E1EE9DDFF168FF382DF82E61E6E2F7DF189D68; Path=/;
Set-Cookie:exp=1692908272; Path=/;

in  page_request_headers.txt I would expect those cookies, but there's "None"
in page_response_body.txt I see the error that I'm not logged on.

I'm doing something wrong?

FoliniC avatar Sep 28 '23 12:09 FoliniC

Will https://github.com/danieldotnl/ha-multiscrape/pull/327 fix the problem? If so looking forward to feedback. :)

jeremicmilan avatar Feb 09 '24 03:02 jeremicmilan

Will #327 fix the problem? If so looking forward to feedback. :)

Me too!

Joao-Sousa-71 avatar May 03 '24 12:05 Joao-Sousa-71

I'm experiencing this too. I'm attempting to scape a mocreo hub using the configuration similar to here: https://gist.github.com/sdrapha/a942171c3ff0ca16b3f74fab6a3e919a

With log_response enabled, I see the set-cookie header being returned from the form in form_submit_response_headers.txt Headers({'content-type': 'text/html; charset=UTF-8', 'set-cookie': 'id=b03494a0-68d8-f13a-c780-8892c20caa1c; Max-Age=86400;'})

but in page_request_headers.txt is only {}

I tried with 7.0.3 and also going back to 6.8 and this still seems to be the case

Does the login form not save cookies between requests? How could it ever have worked for anyone? What am I missing??

Thanks!

rubinlinux avatar Jun 04 '24 04:06 rubinlinux

Actually, I think #368 solves this issue.

jeremicmilan avatar Jun 09 '24 07:06 jeremicmilan

Please try release 7.1.2 and let me know if it addresses your issue!

danieldotnl avatar Aug 27 '24 13:08 danieldotnl