Closed Akshay-Prakash closed 4 months ago
Hi @Akshay-Prakash To log out a user after login you can use its built-in logout method.
url(r'logout/', knox_views.LogoutView.as_view(), name='knox_logout'),
By hitting the above URL your token will get deleted. and by hitting login you must get a token in response which you can use to authentication another request.
I have the following structure where a single project has an api app which serves RestAPIs, and a web app which makes HTTP requests to those RestAPIs. The problem is if I get the token of a particular user, that user is logged in the app while I just want to get the token after the user fills login form, and include that in header for each request. The user is not logged out even if I restart browser, restart app, clear cookie/cache or open a new incognito window
Project structure Project ├── project │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── api │ ..... │ ├── models.py │ ├── urls.py------>contains url for knox auth │ └── views.py ---->uses default authentication_classes, override LoginView as mentioned here ├── templates │ └── base.html └── web_app ├── ............ ├── migrations ├── models.py ├── urls.py └── views.py---->all views authentication_classes=([SessionAuthentication])
settings.py
api>views.py overriding the login view as mentioned here
api>urls.py
web_app>views
base.html
I'am not storing the token anywhere in session/cookies Any ideas how to solve this issue?