What I want:
I have a Django web server with PostgreSQL database on Heroku, I want to store and display some data (like High Scores and similar) from my unity game.
What I managed to do:
I managed to create get and post requests in C# and get responds from them.
My problem:
The post requests only work if I have CSRF(I have some knowledge how it works and my assumption is that I should keep it on) turned off in my Django web server.
My question:
Can I, and how (preferably in a simple and easy way) send some simple data (strings) to my Django web server hosted on Heroku from a C# script run in my Unity game while having CSRF on (or if I don't need it to be on/use some other kind of protection).
Asked
Active
Viewed 279 times
0

Kasp
- 1
-
Do you have any type of authentication on your site, or just posting to an endpoint that handles your call? – Fredrik Schön May 20 '21 at 12:45
-
[This answer](https://stackoverflow.com/a/34316546/6730803) shows how to exclude an endpoint from the CSRF. If you want to keep the CSRF, you'll need make some kind of handshake with the server to get a token and then add that to the request. [The docs](https://docs.djangoproject.com/en/3.2/ref/csrf/) explains how to do that – Fredrik Schön May 20 '21 at 12:48