Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DRF + React is Session auth usable?

Tags:

reactjs

django

I am trying to use Session auth in Django with React. All my GET REST calls are being reject with status 403. I probably have to send sessionidin headers, but sessionid cookie is HTTP only, so my JS code gets a null value when reading it. If I set the cookie to not be HTTP-only anymore, I can read it and send it in headers, but still seing the same problem. Note: the view which includes the React app has a path /app, the REST api path is /api. Could this be the problem?

like image 957
vicusbass Avatar asked Mar 25 '26 19:03

vicusbass


1 Answers

This is actually related to the fetch library I am using for making API calls. In order to send the sessionid automatically, credentials: include must be added in options.

like image 68
vicusbass Avatar answered Mar 27 '26 07:03

vicusbass



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!