CSRF Token - PUT request

I’m trying to send a PUT request to the server including a CSRF Token in the header of the request.

String putData = “…”;

client.beginRequest();

client.post("/system/detail/1/");

client.sendHeader(“Content-Type”, “application/json”);

client.sendHeader(“Content-Length”, putData.length());

1- client.sendHeader(“Authorization”, “Token 53309ada5403ad2138485272facc6a2275ac6c2a”);
2- client.sendHeader(“X-CSRFToken”, “53309ada5403ad2138485272facc6a2275ac6c2a”);
3- client.sendHeader(“csrf-token”, “53309ada5403ad2138485272facc6a2275ac6c2a”);

client.beginBody();

client.print(putData);

client.endRequest();


I’ve tried the three ways(red ones) one by one to attach the CSRF token to the header, none of the works.
the message I get from my server: {“detail”:“Authentication credentials were not provided.”}
How can I attach a CSRF Token to the put request?
THANKS A LOT!

SOLVED!

actually I didn't change anything. I used the following method which I also mentioned in my question.

client.sendHeader("Authorization", "Token 53309ada5403ad2138485272facc6a2275ac6c2a");

I just restart the Arduino and the server... it worked :smiley: