Session authentication using django + react

Does session authentication fully works with react pages. So if permission based pages how it will work. Earlier I am using the django html pages with template rendering. Now I am trying to learn more about the react. I want to give it a try but I am using session authentication now with the django. But I want to know that it will be possible to develop fully session based authentication is it directly possible or a third party package is needed. Directly i tried with my login page in the react. But when I am calling the api with it the IsAuthenticated method is giving 403 forbidden.

Did I miss anything.

Yes it works! There’s a good allauth demo here: https://react.demo.allauth.org, and it’s also my default setup for SaaS Pegasus react projects. The main thing is that you have to get the CORS/CSRF setup right, which can be a bit finicky. Make sure you set CORS_ALLOWED_ORIGINS, CSRF_COOKIE_DOMAIN and SESSION_COOKIE_DOMAIN to include wherever you’re hosting your React app. You might also need to set some settings on the react side to ensure it routes correctly, but this will depend on how you’re running/hosting it.

Thanks for the reply @czue :slightly_smiling_face: .