Jsonwebtoken active session count in nodejs

118 views Asked by At

In nodejs app can we count number of active login , on the token based system .

I need to check on before login that no one is login in node app , This app is only for 1 Admin login at a time .

My logic is to achive this , I am thinking anyhow if I can count active session , if count is == 0 only then allow to login .

Please suggest me any better way if there .

1

There are 1 answers

0
Siddharth Nayar On

You cannot achieve the same with JWT and keep the server stateless at the same time. You’ll need to store a count on the server and check every time a login is attempted.