I am creating my 1st django-react application, but i got stuck on the login process.
Currently i am using simplejwt, while i can keep the access token inside react state, the refresh token has to be stored somewhere, which will leave the refresh token open for XSS.
I might not understand how JWT is supposed to be working, but if it is encrypting user info with secret key from the backend, then why not make it so that it encrypts the IP of the user too.
So that if the refresh token is stolen, we can check the encrypted IP inside the refresh token against the IP from the request, if they match: good, else: reject.
Sure that means if the user changes the IP using a VPN for example that will make him have to login again, but that is rare, and it's just re-login.