iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.62k stars 302 forks source link

Adding optional support for setting the cookie domain for JWT authentication tokens #568

Closed adrenaline681 closed 7 months ago

adrenaline681 commented 7 months ago

Users using SPA commonly set their backend in a separate subdomain like for example api.example.com. When the JWT auth token cookie is set, it will only be set on that domain (api.example.com).

With this update users can have the option to change the domain where the auth cookies are set thus allowing the cookies to be set for all subdomains. It also fixes issues when Server Side Rendering pages in frameworks like NextJs where the SSR part of the application has no access to the auth cookies thus can't forward them to the Django backend.

Fixes issue #238

Thanks for your time.

PS: It's my first contribution on GitHub :)

iMerica commented 7 months ago

Thanks for your contribution @adrenaline681

AydSu commented 5 months ago

I see that JWT_AUTH_COOKIE_DOMAIN is merged into master. But I can't see it in https://dj-rest-auth.readthedocs.io/en/latest/configuration.html#. Is readthedocs updated?