allow one concurrent user per login with JWT

前端 未结 5 936
闹比i
闹比i 2020-12-16 15:13

We developing an application with Laravel/PHP and we want to use an pay-per-user pricing model. For that we have to ensure that an account can only used by only one concurre

5条回答
  •  鱼传尺愫
    2020-12-16 15:47

    Only answer i can think of:

    On login: "User" in your DB has a value = activeJwt

    User logs in and JWT token is created, copy the JWT string to value activeJWT in your DB and send it to user. If you login on another device same deal, and the activeJWT value is changed

    On all requests that require login match users JWT-string and activeJWT, if they dont match it means another device logged in after making the old token useless.

提交回复
热议问题