Home:ALL Converter>Django: web app And mobile app: which authentication system to choose: Jwt vs session cookie

Django: web app And mobile app: which authentication system to choose: Jwt vs session cookie

Ask Time:2018-10-13T02:49:27         Author:Santhosh

Json Formatter

I have Django project:

Web App: I will be creating a web app where Django serves the html pages.

Mobile App: Here Django acts as backend and Android acts as Frontend. Django api end points supply the data

I am thinking to use JWT for both. But I am not sure how JWT can be managed in web APP.

Suppose some one opens the web app in two chrome tabs for working convinience. After some time he logs out in one of the tab.

If its session cookies, then the other tab will ask for login if one tries to perform any authorized task.

Here how to do this with JWT. I think the only way is i have to expire the JWT

But if i expire the JWT token i will face another problem.

Assume i am loggged into site in firefox and chrome simultaneously

If I expire the JWt token to logout then both chrome and firefox sessions will be logged out. But I want to logout only on chrome or firefox and keep the other live.

For mobile app: I am planning to use long lived JWT tokens.

Author:Santhosh,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52785465/django-web-app-and-mobile-app-which-authentication-system-to-choose-jwt-vs-se
yy