I am using Django Rest Framework (DRF) with session authentication, but I am encountering an issue where sessions are not working in the Chrome browser. Can anyone provide assistance or guidance?
Have you created APIs and use them in other frameworks like React?
Please give more context on how you are trying to work with sessions.
Yes, on the frontend, I am using Next.js, and on the backend, I’m using Django Rest Framework (DRF) with session authentication.
During the login process, I store a few values in the session like this:
- Login API: After validating the user’s credentials, I store a value in the session as follows:
verify_code = 123456
request.session[‘verify_code’] = verify_code
- Verify Code API: In this API, I attempt to retrieve the session value using request.session.get(‘verify_code’), but I am unable to retrieve it. Instead, I’m getting a None value.
I’m facing this issue specifically in Chrome and Edge browsers. How can I resolve this?