RindusIoTJam / personio-timelogger

Log your attendance at Personio with a simple python script and get a Slack confirmation.
5 stars 4 forks source link

CSRF token mismatch #25

Open flybyray opened 6 months ago

flybyray commented 6 months ago

How you can handle errors like?

"Error: 2024-04-19 - CSRF token mismatch."

https://github.com/RindusIoTJam/personio-timelogger/blob/bf146ebd1ac5d726fb890186de92b1d38d3ef5e2/client/personio-timelogger.py#L152-L168

flybyray commented 6 months ago

When i put the XSRF-TOKEN from session.cookies into session.headers as X-CSRF-TOKEN and X-XSRF-TOKEN right before the session.post it works for me without this error message.

    session.headers.update(
        {
            "X-CSRF-TOKEN": session.cookies["XSRF-TOKEN"],
            "X-XSRF-TOKEN": session.cookies["XSRF-TOKEN"],
        }
    )